Solved

List all my Shopify pages on one page?

Mark171
New Member
5 0 0

I want to take all of the pages I have created and list them out on one Shopify page, so I'll end up with a list of links like:

 

https://domain.com/pages/this-page

https://domain.com/pages/that-page/

https://domain.com/pages/another-page/

 

I found some Twig code and I have tried to insert it into another page, but it just displays the code and not the pages:

 

{% for page in pages %}
<a href="{{ page.url }}">{{ page.title }}</a>
{% endfor %}

Has anyone attempted this before?

 

Accepted Solution (1)
pawankumar
Shopify Partner
514 66 91

This is an accepted solution.

You have to do it through some steps
1. Create a page in backend
2. Search your page in theme customize
on a screen like this

pawankumar_0-1676882604400.png

3. Create a page template from here or through liquid code

 

image-new-template.png

4. Add that code in directly in theme code in that template or add a custom liquid section in newly created template
Please check if you are able to do that on your side or you need more assistance.
Thanks!

 

- Need a Shopify developer? Chat on WhatsApp +91-9467121281
- Coffee Tip: Buymeacoffee  | Email: thepkpawankumar@gmail.com
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Best regards,
Pawan

View solution in original post

Replies 13 (13)

pawankumar
Shopify Partner
514 66 91

Hi,
It should work fine
Where are you trying it, Can you please explain more ?
Here is the Shopify Doc regarding it
Thanks!

- Need a Shopify developer? Chat on WhatsApp +91-9467121281
- Coffee Tip: Buymeacoffee  | Email: thepkpawankumar@gmail.com
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Best regards,
Pawan
Mark171
New Member
5 0 0

I want to create a page in the usual way from:

 

domain.myshopify.com/admin/pages/new

 

and on this page can I paste some Twig content? Like pasting in raw HTML except I'd like to use Twig, like this somehow:

 

Mark171_0-1676635054612.png

Is this possible?

pawankumar
Shopify Partner
514 66 91

Custom liquid will not work in page description, you can create separate template for that and put this code there in theme files

- Need a Shopify developer? Chat on WhatsApp +91-9467121281
- Coffee Tip: Buymeacoffee  | Email: thepkpawankumar@gmail.com
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Best regards,
Pawan
Mark171
New Member
5 0 0

Could you give me a pointer how I could create a page with just a list of my pages on? I am familiar with using Liquid/Twig.

Estrada
Visitor
3 0 0
  1. In your Shopify admin, go to Online Store > Pages and create a new page.
  2. Give the page a title, such as "List of Pages".
  3. In the body of the page, switch to the HTML editor by clicking the "<>" icon in the toolbar.
  4. In the HTML editor, create an unordered list (<ul>) to hold your links.
Mark171
New Member
5 0 0

I need to create a list of pages automatically. 

pawankumar
Shopify Partner
514 66 91

Yes, it will be automatic list of all pages on the website but you have to put your code in liquid, in page content,  liquid code does not work.
Thanks!

- Need a Shopify developer? Chat on WhatsApp +91-9467121281
- Coffee Tip: Buymeacoffee  | Email: thepkpawankumar@gmail.com
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Best regards,
Pawan
Mark171
New Member
5 0 0

So I would create a page that I could access by /pages/page-name and then I put the Liquid code into a template. How do I unite these two processes?

pawankumar
Shopify Partner
514 66 91

This is an accepted solution.

You have to do it through some steps
1. Create a page in backend
2. Search your page in theme customize
on a screen like this

pawankumar_0-1676882604400.png

3. Create a page template from here or through liquid code

 

image-new-template.png

4. Add that code in directly in theme code in that template or add a custom liquid section in newly created template
Please check if you are able to do that on your side or you need more assistance.
Thanks!

 

- Need a Shopify developer? Chat on WhatsApp +91-9467121281
- Coffee Tip: Buymeacoffee  | Email: thepkpawankumar@gmail.com
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Best regards,
Pawan
johstrom
Excursionist
19 0 2

Hi,

thanks for this solution! But I wonder if there is a way to show only a certain type of pages? For example pages with the prefix "/pages/forfattare/xxxx".

 

With kind regards,

 - Johan.

pawankumar
Shopify Partner
514 66 91

Hi @johstrom 
Please try metaobject pages: https://help.shopify.com/en/manual/custom-data/metaobjects/webpages for such structure, also you can assign a custom template to metaobject pages
I hope, it will be helpful for you
Thanks!

- Need a Shopify developer? Chat on WhatsApp +91-9467121281
- Coffee Tip: Buymeacoffee  | Email: thepkpawankumar@gmail.com
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Best regards,
Pawan
johstrom
Excursionist
19 0 2

Hi!


@pawankumar wrote:

Please try metaobject pages: https://help.shopify.com/en/manual/custom-data/metaobjects/webpages for such structure, also you can assign a custom template to metaobject pages


This is exactly what I have done. But now I want to show these metaobject pages for the visitor (and for Google) in a good way. I can't find out how I can showcase them. If it were a blog I could create a page and set up a section for showing blog posts, but all these metaobject pages is just there in the background - hopefully Google find them with the sitemap (seems to be present there), but a visitor can't find them at all. These pages isn't even searchable - though I have asked Search & Discovery to show search results for "Pages" - it seems only show manual, ordinary pages. 

 

Any ideas?

pawankumar
Shopify Partner
514 66 91

Those are already searchable if you have enabled them from metaobject definition. And those are included in sitemap as well. To show them to the visitor you can add them to navigation, you can add other sections to these from metaobject page template and you can get their link from content tab in left side bar in admin

Thanks

- Need a Shopify developer? Chat on WhatsApp +91-9467121281
- Coffee Tip: Buymeacoffee  | Email: thepkpawankumar@gmail.com
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Best regards,
Pawan