link_to_add_tag
This helper is used to generate an <a> tag with the href attribute. The link address will include the specified tag passed as a parameter to navigate to the current collection page. The resulting page will filter and display products with the specified tag, and if the page already has other tags, they will be appended to the tag parameter.
Please note that this helper is only supported for product collection pages and is not compatible with other pages.
Params
tag{String}Product type, requiredhash.text{String}text is used to generate theatag display content text, if passed in non-string will be converted to empty string by default[attribute]{Object}attribute of form html, optional, format: class="_class"returns{String}html
Usage
{{ link_to_add_tag tag [attribute] }}
Example
{{#each collection.all_tags as |tag|}}
{{#if (contains ../current_tags tag) }}
{{ tag }}
{{else}}
{{ link_to_add_tag tag class="link-class" title=tag text=tag }}
{{/if}}
{{/each}}
Was this article helpful to you?