Hugo type: bug?

Hello guys,
I try to build a little author page where every author can write a little description and below there will be a list of all of his written posts. The URL looks like: “/content/author/{nameslug}/”
In the markdown file I specify the type called author. The HTML file for that lies under “/layouts/author/single.html”. And everything works fine.

The problem is, that if I try to enter “localhost:1313/author/” i’ll get an 404 Error, which makes sense because there is no index file. So I decided to create a “/content/author/” which has also the specified “type: author”. If I open this page I’ll get an overview of the authors which I coded in the single.html file. But now i can’t reach my author pages on “localhost:1313/author/{nameslug}” it just says 404 Error, but the files are existend?


type: author
id: ts
name: Tobias
my description


type: author


{{ define "main" }}
    {{ $lastUrlElement := index (last 1 (split (delimit (split .Permalink "/") "," "") ",")) 0 }}

    {{ if in $lastUrlElement "author" }}
        <h1>authorList View</h1>
    {{ else }}
        <h1>authorPage View</h1>
    {{ end }}
{{ end }}

But the authorPage (“localhost:1313/author/{nameslug}”) will result in an 404 not found error. If I delete the under “/content/” everything works but the: “localhost:1313/author” page results in an 404 error.

Thank you in advance

This should be a file (note the "_"). This will tell Hugo that /author/ is a branch, or list page, and has child pages (/author/author-one/).

When you have content/author/, Hugo treats it as a “single” (or leaf bundle) page. This means that there are no child pages, but instead md files under it are treated as Page Resources.

Consequently, you also need a list.html template that content/author/ will use to render the page.

1 Like

Thank you very much, the underscore fixed everything…

I knew that it can’t be this hard.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.