I can't get author taxonomy pages to work

I’m following this tutorial https://www.netlify.com/blog/2018/07/24/hugo-tips-how-to-create-author-pages/ but I’ve broken something :slight_smile: Thanks for any help.

First, the author page URL and author name don’t show up in summary.html; is there something wrong with the author parameter? The author bio and link list pages do exist and I can go directly to them via the URL.

And two, I’d like to convert this to use a single author for each post; I don’t need multiple authors on each post. But I do want to have multiple authors with each having their own bio and link page.

My config.toml

baseURL = “” # this doesn’t make a difference with the author permalinks

tag = “tags”
category = “categories”
author = “authors”

posts = “/:year/:month/:title/”

Site directory structure; all theme files are in layouts; I’m not using a theme in root/themes:


In the header of a post:

author: ["Joe Blue"]

And this is in summary.html This must be where the real issue is; the permalink and the author’s name do not display.

{{- range .Params.authors }}
  {{- with $.Site.GetPage "taxonomyTerm" (printf "authors/%s" (urlize .)) }}
   <a href="{{ .Permalink }}">{{ .Params.authors }}</a>
 {{ end }}
{{ end }}

You probably need to use authors: ["name"] here, as your taxonomy is configured as author = "authors". You need to use the plural form in defining taxonomies in content.

You are range-ing over .Params.authors, again the plural, while you have the singular in use. This means you are essentially range-ing over an empty set.

Once you’ve fixed that, you probably also find an issue with

specifically the .Params.authors, because you are inside the with context here, which changes the dot context.

You can fix that by using the examples in the docs here, and here.

{{- range .Params.authors }}
  {{ $author := . }}
  {{- with $.Site.GetPage (printf "authors/%s" .) }}
    <a href="{{ .Permalink }}">{{ $author }} or {{.Title}} </a>
  {{ end }}
{{ end }}

Thanks, that’s interesting; I’m just a beginner. I changed author to plural in the post.
Now, with my function, if I use <a href="{{ .Permalink }}">{{ .Params.authors }}</a> I see the correct author link in dev tools, but not on the page. Strange. It’s not being affected by CSS. When using your function, for some reason, nothing prints.

That’s because of the dot context I mentioned. Inside the with block, the dot is the page of authors/foo/_index.md. So the .Permalink would be correct, pointing to yoursite.com/authors/foo/. It will be looking for the .Params.authors in the frontmatter of authors/foo/_index.md as well however, which probably does not exist (since it would actually be in your content/posts/whatever.md).

It should work. If it doesn’t, have a read over at Requesting Help as we probably need to see more of your code to help. What version of Hugo are you using?

Ah, thanks! I had to add authors: "Joe Blue" to the top of authors/foo/_index.md and now my function works. So that’s an oversight in that linked article in my original post.

I’m using Hugo 64.1 via Brew on OS X.