In this case, we will create categories and archives for blog posts, which usually correspond to sidebars.
In fact, Shopify by default does not provide a category list or archive. However, as a blogger, I thought it would be inconvenient not to have a sidebar, so I will summarize how to implement a sidebar in this article. I know some HTML and CSS! The following is for those who are familiar with the concept.
By the way, here is the image I want to implement!
(Wordpress blog I used to do)
In this article, the archive and category sections on the right are supposed to be created. So let's get started.
Shopify's structure does not provide categories.
The first premise is that Shopify blogs do not provide categories themselves.
Therefore, we will use "tags" to create blog categories and archives.
By the way, this is what a Shopify blog post looks like before it is created.
The post is in the middle and both sides are blank. Unless you are using a special theme, you probably have a structure like this.
The goal of this project is to change that to the current structure with a sidebar on the right (or bottom if you are on a smartphone).
Display the category list next to the blog post.
Create a new blog-sidebar section
Copy and paste this into a new section.
In this case, since we wanted to display only "Theme Development" and "Management," we limited the tags to the two described above. Since the tags will be used in the archives later on, we decided to limit the number of tags to only two, since displaying all the tags would include unnecessary tags.
Save this section. I saved it as blog-sidebar.liquid.
Now, insert the code below where you want the sidebar to appear, and the sidebar should appear. (For Shopify's default debut theme, add it to templates/article.liquid!)
It doesn't look great because I didn't apply a design, but now we have a sidebar for the blog.
Create an archive for your Shopify blog
Next, we will create an archive in the sidebar next to the Shopify blog post.
Once again the image looks like this
This one also needs to be tagged, so each post will be tagged as "September 2020" and so on.
Note: If you do not add zeros, for example, from September to September, the sorting will not work properly, so be sure to add zeros for single-digit months.
When you have finished adding tags to each blog post, copy and paste the code below under the blog-sidebar.liquid you just created. The logic is the same." The tags with "year" and "month" are picked up and displayed in the sidebar.
Now you have an archive! (Only one article is tagged, so there is only one item.)
This is how it should look!
Either way, the design needs to be adjusted. (Perhaps by the time you are looking at this article, the right sidebar on the EC-PENGUIN site will have been adjusted quite a bit, lol)
How to create sidebars for categories, archives, etc. on Shopify blog posts Summary
How was that?
It would be sad to see a visitor leave your blog after just one post. We want them to see several articles if they have gone through the trouble.
A sidebar may be a good opportunity for them to read more than one article. I would also like to make a sidebar item for ranking articles. I will try later ☺️.
Have a great day!