I want to get into taxonomies, but I must say I have stumbled with the documentation.
-
layouts/tags/list.html
I assumed listed/rendered/tags/index.html
but it’s not! It’s actually/tags/$tagname/index.html
… aka the term! -
layouts/tags/terms.html
I assumed was/tags/$tagname/index.html
as I assumed $tagname was a term, but it’s not! It’s actually/tags/index.html
… the listing of taxonomy! i.e.layouts/tags/terms.html
renders/tags/
!
The example template here: https://gohugo.io/templates/taxonomy-templates/#order-alphabetically-example … what is it for? list.html or terms.html? It’s not clear.
I think I have a minimal tag site produced with this shell:
hugo new site ${1:-"testing"}
cd ${1:-"testing"}
mkdir layouts/_default layouts/tags
echo -e "<h1>Hello from layouts - single</h1>\n{{ .Content }}" > layouts/_default/single.html
cat << EOL > layouts/tags/terms.html
<h1>In tags/terms!!!</h1>
<ul>
{{ range .Data.Terms.Alphabetical }}
<!-- RelPermalink does not work in this context -->
<li><a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> {{ .Count }}</li>
{{ end }}
</ul>
EOL
cat << EOL > layouts/tags/list.html
<h1>In tags/list!!!</h1>
{{ range .Pages }}
<li>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</li>
{{ end }}
EOL
cat << EOL > content/foo.md
---
Title: Mr Foo
tags:
- foo
---
Hello from **Foo**
EOL
cat << EOL > content/bar.md
---
Title: Mr Bar
tags:
- bar
---
Hello from **Bar**
EOL
cat << EOL > content/curveball.md
---
Title: Curve ball
tags:
- bar
---
Hello from **Curveball**
EOL
hugo --disableKinds=RSS,sitemap
Could it be improved? Please let me know!