List taxonomy tags of current section

Hi all,

I’ve been trying to figure out how to list the tags i have for a current section.

this code gives me compiling error

<ul id="tags-single">
<li>Tags:</li>
{{ range .CurrentSection.tags }}
  <li><a href="{{ $.Site.BaseURL }}tags/{{ . | urlize }}">{{ . }}</a> </li>
{{ end }}

ERROR 2019/01/25 14:56:44 Failed to render pages: render of "section" failed: "c:\code\hugobootstrap\hugobootstrapvanilla\themes\bis\layouts\case\list.html:32:28": execute of template failed: template: case\list.html:32:28: executing "main" at <.CurrentSection.tags>: can't evaluate field tags in type *hugolib.Page

My content is listed under /content/case and /content/blogg

My wish is when i go to either of those list pages i can show the tags associated with their respective section.

The md files looks like this for example:

---

title: "Case1"

date: 2019-01-22T14:51:45+01:00

draft: false

categories: ["case"]

tags: ["Html","CSS"]

---

Ett random case

I have tried with this code but it lists all the tags for the entire site. How would i do to only show the tags under category “case” for example?

{{ range $name, $taxonomy := .Site.Taxonomies.tags }}
              {{ with $.Site.GetPage (printf "/tags/%s" $name )  }}
                  <li><a href="{{ .Permalink }}">{{ $name }}</a></li>
{{ end }}
{{ end }}
1 Like

use this:

{{ range $taxonomyname, $taxonomy := where .Site.Taxonomies.categories ".Page.Section" .Section }}
    <li><a href="{{ "categories/" | relLangURL}}{{ $taxonomyname | urlize }}">{{ $taxonomyname }}</a></li>
{{ end }}

or see How to list all tags of section?