Tags

The tags collection contains all tags that are assigned to the page in the current context. When iterating the tags using a foreach loop, the current tag can be accessed using the :tag variable.

<@ foreach in tags @>
  <span>@{ :tag }</span>
<@ end @>

Since the context changes while iterating a pagelist, the tags collection inside such a loop always refers to the page of the current iteration.

Example

The following example generates a list of tags that link to another page, passing each tag as a query string parameter. On the target page, that parameter can then be used to filter a pagelist. The urlTagLinkTarget variable makes the target page configurable in the dashboard.

<@ if @{ tags } @>
  <ul class="tags">
    <@ foreach in tags @>
      <li>
        <a href="@{ urlTagLinkTarget | def ('/') }?filter=@{ :tag }">
          @{ :tag }
        </a>
      </li>
    <@ end @>
  </ul>
<@ end @>

On the target page, the list of pages can be filtered by the selected tag as follows:

<@ newPagelist { filter: @{ ?filter } } @>
Filelist Filters