Category/tag descriptions


#1

Hi Grav supporters,

I have searched around the documentation/forum/web for a way to add tag/category descriptions, and output them in a theme.

Any good hints?

Cheers,

Stefan


#2

This was asked in Slack by @RosemaryOrchard a while ago. I liked the idea and started building something.

I thought I had put it up on Github, but it seems I didn’t. I stopped work because I got stuck on a issue with routing, and there was something else I can’t quite remember that cast doubt on whether I could make something generally useful. I think I even forgot even to tell Rose, the original poster of the question.

I have something working I can put up for you. It’s a proof of concept plugin where you can set term metadata in a folder like user/pages/taxonomies//term.md and it is exposed to templates like myterm.header.description. I got that working. I wish I could remember why I thought it was doomed …

Also there’s a Github issue in core for the concept, and you could show support perhaps by describing your use case!


#3

I’m spitballing here, but Twig can already see the taxonomy of the page (via page.taxonomy.*), and it can also see variables in the site.yaml config (via config.site.*). Just create a map in your site.yaml that maps tags and categories to descriptions. No plugin required.


#4

Yup, that should do it :slight_smile: I was thinking (as I do!) of a fully fleshed taxonomy with arbitrary term properties. Am particularly interested in one day relating terms to each other, which is actually a big part of what distinguishes a taxonomy from a simple controlled vocab/list. “Taxonomy” is routinely malappropriated in the CMS world!


#5

Indeed true. It should be relatively straightforward to create a plugin that processes a taxonomy definition and then produces various “related links” and stuff from there. I just don’t know enough about current practice to know where to start.