Link to Parent Blog from Article

Highlighted
New Member
1 0 0

I'm trying to add a "back to all posts" link on the blog post page that links back to its parent. It needs to be dynamic because there are multiple blogs and I can't hardcode it. My code thus far is:

<a class="p1 block text-center pointer color--tertiary-text hv--tertiary-accent" href="{{ 'blog.url' }}">All Posts</a>

 But this just returns the URL with "blog.url" instead of the article URL. Any help would be appreciated, thanks!

0 Likes
Highlighted
New Member
1 0 0

You should be able to just use:

{{ blog.url }}

vs

{{  'blog.url' }}

 

Your code was making Liquid spit out `blog.url` as a string (literally `blog.url` vs as a property of a Liquid variable. Just make sure to use the above code on an Article page so that Shopify knows what to evaluate `blog` as.

0 Likes