Highlight an entry in a taxonomy


I use a tag taxonomy for the articles of my website. However, I would like to highlight some articles.
For example, let say that I have different articles speaking about dogs, but one of them is the one to read first and foremost because it is the most important one. I would like to highlight this particular article in the list of all articles about dogs, something like that:


  • The best dog
  • All you need to know on dogs
  • Doggo forever

Weights do not seem to be the answer to do this. So is there a way to achieve this kind of highlight?

If possible, I would like to say that this article should be highlighted for this particular tag directly in the markdown file corresponding to the article.

I want to choose for which tags the article is highlighted. So if said article is tagged with both ‘dog’ and ‘cat’, I want to be able to highlight it in the list of ‘dog’ articles but not in the list of ‘cat’ articles.

In said a article could use a front matter parameter like:

bold = true

And then in the relevant template conditionally add a class to the article links with something like:
{{ with .Params.bold }} bold{{ end }}

It is an interesting solution, however it will highlight said article in the lists of every related tag. I would like to highlight it only for specified tags. I corrected my first post so it is more precise now.

The way to do what you ask needs an understanding of conditional logic.

I will point you further to a direction (as I already did) but I do not have the time to test the conditions for you.

You should look into rendering the tags as classes for your individual articles.
With something like: {{ if .IsPage }}{{ delimit .Params.tags " " }}{{ end }}

The .IsPage condition is needed because the tags taxonomy may not be present on non-regular pages (like lists). If you do not include this, you may end up having an error because delimit will be looking for .Params.tags in every content file and if it does not find the tags the build will break.

In the relevant taxonomy template add the taxonomy term as a class on the article list container, something like container class="{{ .Term }}"

Then in your stylesheet write the rules you need, like for example: .container.apple article.apple { font-weight: 600; } or whatever.

@alexandros Ok. I will look into this. Thank you for the hint!