Skip to main content

link_to

string | link_to: string
returns string

Generates an HTML <a> tag.

{{ 'Shopify' | link_to: 'https://www.shopify.com' }}

Output

<a href="https://www.shopify.com" title="" rel="nofollow">Shopify</a>
string | link_to_type: attribute: string

You can specify HTML attributes by including a parameter that matches the attribute name, and the desired value.

{{ 'Shopify' | link_to: 'https://www.shopify.com', class: 'link-class' }}

Output

<a class="link-class" href="https://www.shopify.com" rel="nofollow">Shopify</a>
Was this page helpful?