> ## 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.

# {{#getPostByTags}} helper

- URL: https://getpublii.com/dev/getpostbytags-helper/
- Published: 2019-02-13T22:16:01.625Z
- Updated: 2024-02-08T09:27:09.740Z
- Description: {{getPostByTags}} is a helper used to retrieve single post data regardless of the current context with use of specific tag ID or tag slugs. Syntax: {{#getPostByTags…
- Author: Tomasz Dziuda
- Tags: Helpers

**{{getPostByTags}}** is a helper used to retrieve single post data regardless of the current context with use of specific tag ID or tag slugs.

Syntax:

```handlebars
{{#getPostByTags TAG_ID "EXCLUDED_POST_ID_1,EXCLUDED_POST_ID_2"}}
...
{{/getPostByTags}}
```

Example:

```handlebars
{{#getPostByTags 1 "3,4"}}
<li>
    <h2>{{ title }}</h2>
    <div>{{{ excerpt }}}</div>
</li>
{{/getPostByTags}}
```

Above example will show a post, which uses tag with ID = 1, excluding posts with post ID equal to 3 or 4.

Posts are ordered by the same order as specified in the site settings.

You can also use tag slugs:

```handlebars
{{#getPostByTags "lorem,ipsum" ""}}
<li>
    <h2>{{ title }}</h2>
    <div>{{{ excerpt }}}</div>
</li>
{{/getPostByTags}}
```

In the above example, code will show a post, which uses tags with slug equal to "lorem" or "ipsum". No posts will be excluded.

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