How to get taxonomy type?

I need to use a taxonomy type for different list page behaviors to create different designs. How do I get the list type and correctly create a condition with if?
Tags and categories differ by only two blocks. Something like the construction below can be done, or perhaps it’s better to create a separate layouts/tags folder and make a separate list.html there. Then the categories themselves would be displayed by default. In the construction below, only the specified tags /tags/ /tags/hot/ work. Other tags do not work. So you need to list them all, or do it differently.

{{ $tags := .Site.Taxonomies.tags }}
{{ if eq .RelPermalink "/tags/" "/tags/hot/" }}
  <h1 class=" bg-red-400">Tags: {{ .Title }}</h1>
{{ else }}
  <h1 class=" bg-red-400">Category: {{ .Title }}</h1>
{{ end }}
{{ if eq .Kind "taxonomy" }}
  {{ .Data.Plural }} → "tags"
{{ end  }}

https://gohugo.io/methods/page/data/#in-a-taxonomy-template

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.