Ad

Link To Homepage (index) Of Store Using Shopify Liquid

- 1 answer

I want to link the logo of my site (in my main header) to the homepage of my store. I could do so by linking to the absolute URL (e.g., https://www.example.com), but that doesn't work when I'm testing on a development server that isn't hooked up to my domain name.

I know that I can link to pages using <a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="{{ pages.example.url }}">, where example is the page I want to link to. But using <a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="{{ pages.index.url }}"> doesn't seem to work — I'm assuming because index is not actually considered a page.

Is there an easy way to link to my store's homepage using a liquid tag?

Ad

Answer

I figured it out, for those curious: Just link to "/". So, a link to the homepage of your site should appear as follows in your header.liquid file:

<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="/">Link</a>
Ad
source: stackoverflow.com
Ad