Hugo

List authors using taxonomy breaks the capitalisation and spacing

Sorry if this is a stupid question, but I haven’t found how to do the following simple thing. I am a beginner so to say…
I have files like content/articles/article1.md with authors information in the front matter, something like

+++
title = "First Article"
authors = [A. Einstein, B. Kennedy]
+++

In my config file I have setup the taxonomy for authors:

[taxonomies]
   author = "authors"

in the index.html I have the following code to display the list of all authors

{{ range $elem_index, $elem_val := .Site.Taxonomies }}
  {{ range $key, $value := $elem_val }}
    {{$key}}<br>
  {{ end }}
{{ end }}

and then it displays

a.-einstein
b.-kennedy

My problem is that I would have like to display the names with the same capitalisation as in the front matters of my articles. Is there a simple way to do it?

You can try .Page.Title instead: https://gohugo.io/templates/taxonomy-templates/#example-list-all-site-tags

1 Like

Thanks a lot! That works perfectly fine. :slight_smile: