Thursday, June 6, 2013

Blog Archives for Shopify [a coding post]

Shopify does not support blog archiving, which is kind of a bummer for clients who are so used to seeing this pretty standard feature on most other blogs they visit.

So I've coded a little workaround using article tags. The client simply needs to enter a tag for each post in this format:YYYY Month. Then, we filter so we can keep using tags as the client expects to use tags. Shopify automatically orders the tags alphanumerically so all we need to do is reverse the order to display most recent date tags first.

Add as many year loops as you think the site could be in operation -- I only show 3 here to keep it simple. Not perfect — a little hard coded, but it's pretty easy for the client and intuitive for the visitor.