Access the Taxonomy Filter in Twig

Hi,
I’m wondering how can i access the taxonomy filter passed via the url in my TWIG-Template.

Simple example
i filter a events for the tag concert and want to print the used filter word on my page…
url: www.mydomain.com/eventslist/tag:concert

how can i print the “concert” tag filter in my twig template?
{{ page.url }} returns only the url without the tag section

br Clemens

@clemens, Try uri instead of url

{{ var_dump(uri.params) }} returns: '/tag:concert'

{{ var_dump(uri.extractParams(uri, ':')) }} returns:

array (size=2)
  0 => string 'http://localhost' (length=16)
  1 => 
    array (size=1)
      'tag' => string 'concert' (length=7)

{{ var_dump(uri.extractParams(uri, ':')[1]['tag']) }} returns: 'concert'

For more functions available for Uri, see Class: \Grav\Common\Uri

1 Like