Shopify, though being an awesome eCommerce platform, is notorious for its poor blogging options.
One of the issues you’ll need to solve sooner or later is to add new dynamic features to the blog, one of the more important ones being a sidebar with the “Recent posts”.

Obviously, there is more than one solution to have this working, but here is one way to do it.

In the Theme options – Edit HTML/CSS open up your blog page, then call for a new snippet:

{% include ‘Recent_Posts’ %}

Create a snippet with the same name (in this case „Recent_Posts), and add this bit of code:

<h2>Recent Posts</h2>
{% for article in limit: 20 %}
<li><a href="{{ article.url }}">{{ article.title }}</a> <span>{{ article.created_at | date: "%d.%m.%Y" }}</span></li>
{% endfor %}

If you want to add it as a sidebar, you can wrapp it in #blog-sidebar and then float it per your need.


Write a comment