Taxomony pages returning 404

I’m making a blog theme and adding links to each post’s authors at the top of the page like this:

{{ range .Params.authors }} <a class="author-link" href="{{ "/authors/" | absURL }}{{ . | urlize }}">{{ . }},</a> {{ end }}

The links show up as expected, but keep returning a 404 page. How can this be when the links are being generated via the page’s params? What am I missing?

Not sure what you mean by that. To me it looks like you are creating them yourself, and it looks like you are doing it wrong. I may have time to go into details later this week.

404 strongly implies that the target of the link is missing. The are you sure that the link is valid?

It would be helpful if you included an example of what your snippet generates and show what you would expect it be.

A post that defines a list of authors in an array in the front matter like this…

    authors = ["Philip","Joe","Sue"]

Produces a set of links as expected…

	
    Philip
    Joe
    Sue   

I’m expecting a list of articles by Philip, Joe, or Sue when I click on the links. Instead, I just get a 404. I hope that clarifies things.

Ok. You’re expecting http://localhost:1313/authors/sue to point to a valid HTML file containing the list of articles written by Sue. Who’s creating the page http://localhost:1313/authors/sue/index.html?

I didn’t think http://localhost:1313/authors/sue/index.html needed to be created. The other taxonomies defined in the front matter (tags, categories, etc) seem to generate links that point to a list of articles that just use the list structure defined in the _default/list.html .

For instance, I use the same structure to create a list of tags. The generated links are something like http://localhost:1313/tags/javascript and point a list of articles tagged ‘javascript’

Should I be making an index page for the author’s taxonomy?

This depends. I want to say it will point to the default list.html if you don’t create default terms.html and taxonomy.html. If you have this in a repo, I’m happy to run it locally and see if I can fix it…

@rdwatters Here’s the repo https://github.com/kayesspea/KSPBlog

The solution that worked for me was to restart the hugo server. Came back up without an issue. Thanks to Tim Bradley 1 year ago for this information!

1 Like