and each of them has some terms associated.
Now in a content page we have a frontmatter like this:
+++
date = "2019-12-31T09:07:05+02:00"
title = "some interesting page"
description = "this is awful stuff"
taxonomy(2) = ["term(21)", "term(24)"]
taxonomy(5) = ["term(52)", "term(53)"]
+++
In a single page template for that section I want to get the taxonomies and their associated terms used in the particular page which of course is a subset of the taxonomies defined in the config.toml.
So for the page above I want to get that taxonomies 2 and 5 with their terms 21 and 24 or 52 and 53 respectively.
Goal is to do something like:
"More articles in [taxonomy(2)](link-to-taxonomy(2)-list-page) about the subjects [term(21)](link-to-term(21)-list-page) and [term(24)](link-to-term(24)-list-page)"
somewhere on each single page.
I could not figure out how to do that. I only found explanations on how to do some sort of navigation based on all of the taxonomies from the config.toml
I cannot believe that noone seems to know the correct syntax of concatenating strings in a template
I’m still struggling with this.
As mentioned in step 2 I have to check the existance of a frontmatter parameter. This is the taxonomy as described in the first entry of this discussion .
So I still try to set a variable, let’s say $taxcheck as a combined string out of ".Params." and the variable $taxonomyname but I cannot figure out how to do this .
Next thing then would be to do an if-statement to check if
either this concatenated variable exists in the page frontmatter
or, if not possible, if this concatenated variable is not empty
I don’t create general use themes that produce taxonomies, so I’m not sure of the exact code I’d use to check.
In my practical case, I generate a layout for each taxonomy as its added to my project, so I can control that aspect. From your original goal, you know what the taxonomies are, to produce the human readable text. That text depends on a human understanding the relationship between the taxonomies.
What you seem to want is a name of the taxonomies used in the front matter of a given piece of content, for it’s own sake (to operate on later). I don’t think many folks have that goal in mind. You know: you set the taxonomies in front matter, how do you not know that they are?
Anyhow, if you needed to know which taxonomy a piece of content has, you can compare the parameters in the front matter to .Site.Taxonomies, and maybe use intersect to produce your list. Or something.
Also, sharing a repo to clone to reproduce your work goes a long way.