link_ to_ add_ tag
string | link_to_add_tag
returns string
Generates an HTML <a>
tag with an href
attribute linking to the current blog or collection, filtered to show
only articles or products that have a given tag, as well as any currently active tags.
Tip
To learn more about filtering by tag, refer to Filter articles by tag or Filter collections by tag.
{% for tag in collection.all_tags %}
{%- if current_tags contains tag -%}
{{ tag }}
{%- else -%}
{{ tag | link_to_add_tag: tag }}
{%- endif -%}
{% endfor %}
{% for tag in collection.all_tags %}
{%- if current_tags contains tag -%}
{{ tag }}
{%- else -%}
{{ tag | link_to_add_tag: tag }}
{%- endif -%}
{% endfor %}
{
"collection": {
"all_tags": [
"extra-potent",
"fresh",
"healing",
"ingredients"
]
},
"template": "collection"
}
Output
<a href="/services/liquid_rendering/extra-potent" title="Narrow selection to products matching tag extra-potent">extra-potent</a>
<a href="/services/liquid_rendering/fresh" title="Narrow selection to products matching tag fresh">fresh</a>
<a href="/services/liquid_rendering/healing" title="Narrow selection to products matching tag healing">healing</a>
<a href="/services/liquid_rendering/ingredients" title="Narrow selection to products matching tag ingredients">ingredients</a>
Was this page helpful?