---
title: 'Liquid filters: link_to_tag'
description: >-
Generates an HTML `` tag with an `href` attribute linking to the current
blog or collection, filtered to show
only articles or products that have a given tag.
api_name: liquid
source_url:
html: 'https://shopify.dev/docs/api/liquid/filters/link_to_tag'
md: 'https://shopify.dev/docs/api/liquid/filters/link_to_tag.md'
---
# link\_to\_tag
```oobleck
string | link_to_tag
```
returns [string](https://shopify.dev/docs/api/liquid/basics#string)
Generates an HTML `` tag with an `href` attribute linking to the current blog or collection, filtered to show only articles or products that have a given tag.
***
**Tip:** To learn more about filtering by tag, refer to \Filter articles by tag\ or \Filter collections by tag\.
***
##### Code
```liquid
{% for tag in collection.all_tags %}
{{- tag | link_to_tag: tag }}
{% endfor %}
```
##### Data
```json
{
"collection": {
"all_tags": [
"extra-potent",
"fresh",
"healing",
"ingredients"
]
},
"template": "collection"
}
```
##### Output
```html
extra-potent
fresh
healing
ingredients
```