How do I display a description of the category and tags on the output page?

Hello friends, my knowledge of Grav continues for what all of you thank you so much.
I encountered another wall, I need to display the description of the category and tag on the output page. Many thanks to all who answered.

For the design of the site, I use the theme “Helium v5.4.24” and the plugin Gantry 5.

PS. Unfortunately I did not succeed as it is indicated here:

1 Like

@dydaevskiy What have you tried sofar and what was unsuccessful about those trials?

Please forgive me for not responding immediately. I tried to do as it was written here:

But unfortunately I have not what happened. I will be very grateful for your help. Thanks

@dydaevskiy You may repeat the url to the solution, but that doesn’t tell me what might have gone wrong in your code… :wink:

Anyway, using theme Quark, try this:

  • In ‘/user/config/site.yaml’ add:
    categories:
      photography: This is about photography
      travel: And this is about travel
      ... etc.
    
  • In ‘/user/themes/quark/templates/blog.html.twig’ add the following lines:
    {% if uri.param('tag') %}
       <h1>{{ site.categories[uri.param('tag')] }}</h1>
    {% endif %}
    
    You could place this line of code somewhere near and above the following lines:
    <div class="bricklayer">
      {% for child in collection %}
    

What does it do?
It will first test if a ‘tag’ parameter is present in the url (e.g. ‘http://localhost/site-blog/tag:photography’). If present, it will use the value of the parameter as index to the ‘taxonomies’ in ‘site.yaml’, which contains the descriptions.

Of course, this should all be done in an inherited theme to prevent loss of changes.

3 Likes

Many thanks for your decision, just as in your version I did not succeed, but thanks to you I managed to make my decision based on yours. Thanks again.

1 Like