How to display taxonomies-category in blog menu?


I would like to display categories in my blog’s menu to list all posts of category , but i don’t found something with indications of how to do.

Por exemplo:

  • Home
  • Lifestyle (taxonomy category 1)
  • Sports (taxonomy category 2)
  • Culture (taxonomy category 3)
  • About
  • Contact

Thanks for any help! :wink:

The navigation is built by twig like any other template. You can use taxonomy.findTaxonomy() (see the docs) when building your menu just as you could anywhere else.

Hi Perlkönig,
I’m starting at the grav and did not know how to start, but I found a post[1] that indicates to install the “taxonomylist” plugin and add the following snippet at the end of the code that renders the navigation menu:


{% set taxlist = taxonomylist.get() %}
{% if taxlist %}
  {% set category = grav.uri.params("category", true) %}
  {% for tax,value in taxlist['category'] %}
  {% set current_page = (tax == category) ? 'active' : '' %}
  <li class="{{ current_page }}">
    <a href="{{ base_url }}/category{{ config.system.param_sep }},{{ tax|e('url') }}">{{ tax|capitalize }}</a>
  {% endfor %}
{% endif %}

It works, but need a few adjustments. :wink:


That will work.