Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't create a link to a page in Shopify

Tags:

shopify

liquid

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.

like image 874
motleydev Avatar asked Nov 01 '12 14:11

motleydev


1 Answers

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 }}

  • http://wiki.shopify.com/Pages
  • http://wiki.shopify.com/Page
like image 139
Zach Lysobey Avatar answered Nov 12 '22 18:11

Zach Lysobey