I am trying to create a single link (inside a snippit) that will link to any given page but I can't figure out how to do it. I am using this general structure:
{{ 'Link Text' | link_to: X }}
I don't know what the parameter for x should be to access page/product on my site. Appreciate any help.
From: http://wiki.shopify.com/Link_to
{{ 'Typo' | link_to: 'http://typo.leetsoft.com' }}
This should create a link that looks like:
<a href="http://typo.leetsoft.com">Typo</a>
More info on links in liquid here: http://wiki.shopify.com/Link
Update 1: You should also be able to use relative links:
{{ 'Typo' | link_to: 'pages/home' }} <!-- relative to current page -->
{{ 'Typo' | link_to: '/pages/home' }} <!-- relative to site root -->
{{ 'Typo' | link_to: '../pages/home' }} <!-- relative to parent dir -->
Update 2: Ore better yet, you can reference the page's handle: {{ 'Title' | pages.pagehandle.url }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With