Unable to create page link in Shopify

I am trying to create a single link (inside snippit) that will link to any given page, but I cannot figure out how to do this. I use this general structure:

{{ 'Link Text' | link_to: X }} 

I do not know what parameter for x should be access to the page / product on my site. Appreciate any help.

+4
source share
1 answer

From: http://wiki.shopify.com/Link_to

 {{ 'Typo' | link_to: 'http://typo.leetsoft.com' }} 

This should create a link that looks like this:

 <a href="http://typo.leetsoft.com">Typo</a> 

Read more about fluid links here: http://wiki.shopify.com/Link

Update 1: You should also 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 is even better, you can refer to the page descriptor: {{'Title' | pages.pagehandle.url}}

+10
source

Source: https://habr.com/ru/post/1443453/


All Articles