How to Show Related Blog Posts (by tags or manually)

Reading Time

Believe it or not, but Shopify's free themes don't ship with one core functionality: showing related blog posts. However, worry not: in this tutorial, you’ll learn how to create a custom Shopify section that displays related blog posts — perfect for boosting engagement and keeping readers on your site longer.

We'll walk through how to add the section to your theme, connect it to your blog post template, and use metafields to manually assign which posts should be displayed as related and if you want you can even skip that last step, and the code developed by our top EZFY professionals will still select blog posts to recommend to your visitors! This will keep your visitors engaged in your store regardless of how much time you want to spend in the process!
Before starting: 👉 Click here to download the code


This tutorial is compatible only with Shopify's official free themes: Colorblock, Craft, Crave, Dawn, Origin, Publisher, Refresh, Ride, Sense, Spotlight, Studio, Taste & Trade.

Looking to install this on a premium or custom theme? Contact us.

Step 1: creating the section file

  1. From your Shopify admin, go to Online Store > Themes > ... > Edit code.


  2. On the left sidebar, scroll down and click on the Sections folder. Then, at the top of that folder, click Add a new section. In the popup that appears:

    • Make sure the file type is set to Liquid
    • Name the file exactly ezfy-related-blog-posts
    • Then click on Done



  3. Now, open the folder you downloaded. Inside it, you’ll find a text file named ezfy-related-blog-posts.txt. Open that file, copy its entire content, paste it into the section file you just created, and click on the Save button at the top right corner.

That’s it for creating the section! Next, let’s add it to your blog post page.

 

Step 2: adding the section to your blog post page

  1. Now that the section file is created, let’s display it on your blog pages. On the top left, click on ... > Customize theme.


  2. At the top center of the screen, click the dropdown that likely says Home page. In the dropdown, navigate to Blog posts > Default blog post (or whatever your blog post template is named)



  3. You're now editing the layout for blog posts. On the left sidebar, scroll down and click the Add section button within the Template category. Scroll through the options or use the search bar to find your new EZFY Related Blog Posts section. Click on it to add it to the page.


  4. Place the section wherever you'd like in the page by clicking and holding it with the left mouse button and dragging it around. Then hit Save at the top right and that's it!

Now, we're going to learn how to set up the related blog posts.

Step 3: creating metadata for related blog posts

  1. To manually select which blog posts will show up in your related section, we’ll add custom metafields to your blog posts. From your Shopify admin, go to Settings > Custom data > Blog posts > Add definition.
     
  2. Fill in the fields with the following information:

    • Name: EZFY Related Blog Posts 
    • Namespace and key: custom.ezfy_related_blog_posts
    • Description: Always display selected blog posts here; if none, show tag-related posts instead. 
  3. Click Select type, then scroll down until you find the URL option, select it. 


  4. Next select List of values to the right then hit the Save button at the bottom once everything is set.


This adds a custom field to all blog posts where you can assign related posts and you'll learn how to do just that in the next and final step.

Step 4: assigning related blog posts using the new metafield

Now that your metafield is created, you can start assigning related blog posts. From your Shopify admin, go to Content > Blog posts. Click on any blog post that you'd like to assign related pages to.


Once inside the blog post editor, there are two ways you can go about it.

1- Scroll all the way down to the Metafields section — you’ll see a field labeled EZFY Related Blog Posts as we named it before.


Click on the empty field, and a box will pop up, paste in it the URL for any blog post of your choice then click on Add item. A new empty field will appear, so you can repeat until all desired blog posts have been inserted!


If that is too much work, you can also use tags as you'll see below.

2- Look for the Tags field to the right of the screen on the Organization category and add to it an identifying tag of your liking.



If the metafield below is empty, our EZFY Related Blog Posts will look into your tags and group the together when populating the section! And even if no tags are being used, blogs will be selected at random so your visitors will always be offered something else to read in your Shopify store!

Regardless of the method chosen, don't forget to click the Save button when you're done!

Conclusion 

And that’s it! You’ve successfully:

    • Created a reusable custom section in your Shopify theme

    • Added it to your blog post layout

    • Set up metafields for related content

    • And learned how to manage related posts from the Shopify admin

Now you can easily recommend relevant blog posts to your readers — improving navigation, time on site, and SEO all at once.

If you have any questions or want to take this further (like adding thumbnails or dates to the related posts), feel free to drop a comment or reach out.

Happy customizing!

Back to blog

Leave a comment