Last active
February 16, 2021 10:36
-
-
Save lukeburford/6550248 to your computer and use it in GitHub Desktop.
Display random post from a Shopify blog, for example on the store homepage. Shopify caches it's pages so a homepage refresh will not show a new post, but adding an item to the cart and returning to the homepage will. Based on: http://wiki.shopify.com/Featuring_one_randomly_picked_product
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% capture index %}{{ 'now' | date: '%S' | times: collections.frontpage.products.size | divided_by: 60 }}{% endcapture %} | |
{% for article in blogs.blog-name.articles offset:index limit:1 %} | |
<a href="{{article.url}}">{{ article.title }}</a> | |
{% endfor %} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for sharing! Why total of products instead of total of posts?