What's your biggest current challenge? Have your say in Community Polls along the right column.

Re: How to display all BLOGS with different CATEGORIES in one page?

How to display all BLOGS with different CATEGORIES in one page?

Cody917
Excursionist
14 0 9

Like product, I can show all product by doing Navigation > Add menu item > All collections

 

But I can't do >all categories for blogs, is there way to show all of the blogs in one page? 

 

Thank you so much for your help.

Replies 16 (16)

oscprofessional
Shopify Partner
16116 2410 3126

You will need to code it.

  • Go to Online Store ->Themes->Actions->Edit Code.
  • You should see multiple liquid files categorized, go under "Templates"->Choose "Add a new template"->Create a new template for 'Page' called 'all-blog'.

oscprofessional_0-1627284157879.png

 

Step 1

 

  • The page you just created will open in an editor. Copy and paste the below code just after the line {{ page.content }}. (Your page might have some different html content but this line will be present): 

Note: Here blog1 and blog2 and blog3 are your blog handles. Go to your respective blog pages and copy the part after the last '/'. Like: 

oscprofessional_1-1627284157529.png

 

 {% assign blog_handles = "blog1,blog2,blog3" | split: "," %}

   {% for handle in blog_handles %}
        {% for article in blogs[handle].articles %}
               <h2><a href="{{ article.url }}">{{ article.title }}</a></h2>
         {% endfor %}
{% endfor %}

 

oscprofessional_2-1627284157614.png

 

Step 2

  • Now, go to page -> Add new page -> Put title whatever you like, I put it 'Blog' -> Choose template suffix on the right side as 'page.all-blog'. Save it.

oscprofessional_3-1627284157768.png

 

Step 3

Go view the page you just created. It will display your article's heading and clicking them will take you to the articles. (Article is alias for blog posts in Shopify).  Read more article object properties here: https://shopify.dev/docs/themes/liquid/reference/objects/article 


Get pass your Store Core Web Vital Free Speed Optimization Audit, Chat on WhatsApp | Skype : oscprofessionals-87 | Email: pallavi@oscprofessionals.com | Hire us | Guaranteed Site Speed Optimization | Website Free Audit | Shopify Theme Customization | Build Shopify Private App | Shopify SEO | Digital Marketing | Oscp Upsell & Cross sell App : Free | Oscp Sales & Volume Discount App : Free | Custom Pricing Wholesale App : Free
Cody917
Excursionist
14 0 9

Thank you! It works but all the template is lost & no blog pic is showing, is there anyway to keep the template while showing all the blogs? @oscprofessional

oscprofessional
Shopify Partner
16116 2410 3126

Try this 

Step 1: Create the special "Blogs" linked-list:

  1. From your Shopify admin, go to 
  2. Click the Add menu button.
  3. Enter Blogs as the Title.
  4. Repeat the following for each blog category that you want listed:
    1. Click Add menu item.
    2. Click in the Link box and select Blogs from the pop-up menu.
    3. Select the Blog that you want displayed.
  5. Click Save menu.

Step 2: Edit your custom page template

  1. Add the following code to your custom page template:

 

 

{% for link in linklists.blogs.links %}
  {% assign blog = link.object %}
  {% for article in blog.articles %}
    <h2><a href="{{ article.url }}">{{ article.title }}</a></h2>
  {% endfor %} 
{% endfor %}

 

 

  1. Click Save.

Let me know if this solves your problem or if you need further help!

Get pass your Store Core Web Vital Free Speed Optimization Audit, Chat on WhatsApp | Skype : oscprofessionals-87 | Email: pallavi@oscprofessionals.com | Hire us | Guaranteed Site Speed Optimization | Website Free Audit | Shopify Theme Customization | Build Shopify Private App | Shopify SEO | Digital Marketing | Oscp Upsell & Cross sell App : Free | Oscp Sales & Volume Discount App : Free | Custom Pricing Wholesale App : Free
ConsciousEarth
Visitor
1 0 0

Hello! I followed your step 1 which worked and then had the same issue of no photos showing in the all blogs listing (https://oneconsciousearth.shop/pages/all-knowledge)

Attempted step 2 and it hasn't changed anything.

Is there another way or maybe more detailed instructions for step 2 (to make sure I am getting it right)?

 

adventmedia
Pathfinder
128 0 33

How do you do this in Dawn theme with json template?

Rajev
Shopify Partner
1 0 0

Hello @oscprofessional, thank you for the above solution which is working. Also could you please add a code on how we can implement the pagination and order of displaying the post based on the date for the above solution? 

 

Thank you

protohominid
Shopify Partner
5 0 0

Hey, this looks like it might work for what I want to do, but what about pagination? I can't have the page load 400+ items...

Saloni1
Tourist
7 0 1

Hello, I am using 'Taste' theme and unfortunately this solution does not work for that anymore. I have looked through the code and I cannot find {{ page.content }} anywhere in that code when a new template is created. Do you know something may have changed in the shopify templates over the last couple years? I am creating a store now and want to show all blog posts on the same page for customers to browse but unfortunately, I am unable to do so. Can you help please? Thanks! 

Yickxin
Visitor
1 0 0

That's also my question. Thank you

3rdDay
Excursionist
28 1 7

Here's one simple way:

 

Create a new page template by going to Online Store > Themes > Customize, then select Pages from the top drop-down menu and 'Create Template'. In the new template, simply add a section after the page content called 'Blog posts', then select a category.

Screenshot 2024-03-23 at 16.33.16.png

Next, add another section below this and select a different category. Repeat this until you have three (or four) blog posts displayed per blog category with a 'View all' button so users can explore all posts from any category.

 

Hope this helps someone!

Asa (3rd Day)
3rdday.co.uk
jennn_here
Shopify Partner
3 0 1

This is the solution I needed! Easy to understand and implement. Thank you for sharing.

cpk_jenna
Visitor
2 0 0

First, thank you so much for this! You are a life saver.

One quick question though (and my apologies if I've missed something obvious) but so I've done this, and now I can see the all-blogs in my theme editor, all the blogs are there, but I can't figure out how to get it to show up on my page. It doesn't show when trying to edit the navigation or my main menu, I can only see all-blogs in the template editor. 

Sorry this is all still very new to me 😅

Thanks again!

3rdDay
Excursionist
28 1 7

I'm glad this has helped you!

 

Have you applied the 'all-blogs' template to a page? If not, pick a page to apply it to or create a new one (Online Store > Pages) and under 'Theme template', select the all-blogs template you created. You can then add that page to your navigation (Online Store > Navigation).

 

Let me know if you have any other questions.

Asa (3rd Day)
3rdday.co.uk
cpk_jenna
Visitor
2 0 0

That must be where I'm doing something wrong then, in creating the template. I can see the template I created on my theme editor:
Screenshot 2024-12-04 160414.png













but when I got to my pages, nothing appears under "theme template" except for "default" and "contact."

Screenshot 2024-12-04 160430.png

 

 

 

 

 

 

 

 

... Now that I'm saying all this though I'm thinking maybe I should have made the template under "Pages" and not under "Blog" 🤔 I'm going to try that. Thank you again for your help! I really appreciate you taking the time. 

Update: That worked, thank you again! 

3rdDay
Excursionist
28 1 7

Brilliant! So glad you found the solution. 🙂

Asa (3rd Day)
3rdday.co.uk
APdc
Visitor
1 0 0

This Worked! Thanks.