ELI5: Author Field

Hello all,

My site is definitely intended to have numerous authors. I’d like to be able to include an author field in each Markdown post file, and have corresponding styles. Or, in rare cases, no author at all. Presently I’m just using an h3 style and ### via Markdown.

Reading the documentation doesn’t illuminate me on this, and the forums only had one post that was relevant to my situation: https://discuss.gohugo.io/t/panic-message-when-running-hugo-server/1260/4 – that’s what happened when I tried to include an author field in the article template.

So, I think it would be beneficial beyond just me if someone could tell me how to do it. I’m not as retarded as I sound! If you can just point me in the right direction, I’ll figure it out, and I promise to come back and write a little snippet in “Tips and Tricks,” for someone else who might find Go a very new thing.

Although, let me say: Hugo has made Go seem like a very cool thing to me.

Thank you in advance!


You can add whatever variables you like to the front matter of your markdown content.

author: Your Name

In the Template:

{{ if .Params.author }}
    ### {{ .Params.author }}
{{ end }}

Documentation: Hugo Variables: Page Parameters

The link you provided seems to be referring to the global Site Author. You can define an author at the site level so you don’t have to redefine the author’s name on each content page.

Documentation: Hugo Variables: Site Variables

1 Like

Thank you.