> ## Content Index
> Fetch the complete content index at: https://getpublii.com/dev/llms.txt
> Use this file to discover other available public pages before exploring further.

# {{#getTags}} helper

- URL: https://getpublii.com/dev/gettags-helper/
- Published: 2019-02-13T22:19:32.332Z
- Updated: 2025-02-21T06:08:11.477Z
- Description: {{getTags}} is a helper used to retrieve tags data regardless of the current context. Syntax: {{#getTags "TAG\_ID1,TAG\_ID2,TAG\_ID3" "before" "after"}} ... {{/getTags}} Example: {{#getTags "1,2,3" "<ul>" "</ul>"}}…
- Author: Tomasz Dziuda
- Tags: Helpers

**{{getTags}}** is a helper used to retrieve tags data regardless of the current context.

Syntax:

```handlebars
{{#getTags "TAG_ID1,TAG_ID2,TAG_ID3" "before" "after"}}
...
{{/getTags}}
```

Example:

```handlebars
{{#getTags "1,2,3" "<ul>" "</ul>"}}
<li>
    {{ name }} ({{postsNumber}})
</li>
{{/getTags}}
```

Tags are ordered by the ID order in the string.

You can also use the **@index** variable to detect the tag number in the specified collection:

```handlebars
{{#getTags "1,2,3" "<ul>" "</ul>"}}
<li>
    {{ name }} ({{postsNumber}})
    {{#checkIf @index '==' 0}}
    <small>IT'S THE FIRST ELEMENT!</small>
    {{/checkIf}}
</li>
{{/getTags}}
```

The second parameter creates HTML prefix, the third parameter creates HTML suffix for the generated output.

**IMPORTANT:** It requires availability of the `@website.contentStructure` global variable

It is possible to combine querystring options with theme option values using the [concatenate](#INTERNAL_LINK#/post/125) helper:

```handlebars
{{#getTags (concatenate @config.custom.TagsDropdown) "<ul>" "</ul>"}}
```
