gohugoio / hugoDocs

The source for https://gohugo.io/
Apache License 2.0
1.06k stars 1.49k forks source link

Document the different ways to configure authors #2494

Open saikadaramakaisosjupita opened 8 months ago

saikadaramakaisosjupita commented 8 months ago

Like using taxonomies, site Params, etc.

See https://discourse.gohugo.io/t/deprecation-warning-for-site-author-confusing-replacement-advice/48874

jmooring commented 8 months ago

Example of using the authors taxonomy to handle site and page authors. Works fine for one or many authors.

git clone --single-branch -b hugo-forum-topic-48874 https://github.com/jmooring/hugo-testing hugo-forum-topic-48874
cd hugo-forum-topic-48874
hugo server

Files of interest:

See comments in partial headers for details.

This approach takes some time to setup, but is infinitely extensible.

Part of this is documented here: https://gohugo.io/templates/taxonomy/#display-metadata

saikadaramakaisosjupita commented 7 months ago

@jmooring I am assuming your comment means this will be documented eventually?

jmooring commented 7 months ago

this will be documented eventually?

Yes, that's why the issue is open.

BPowell76 commented 6 months ago

I don't understand what was wrong with using author in the frontmatter. As someone new to using Hugo this is frustrating and I see it as an unnecessary change.

jmooring commented 6 months ago

Author

You can create an author front matter parameter. For example:

[params.author]
email = 'jdoe@example.org'
name = 'John Doe'

Then access the value from a template:

{{ .Params.author.name }}
{{ .Params.author.email }}

What you can't do (deprecated):

{{ .Author }}

Authors

You can create an authors front matter parameter. For example:

[[params.authors]]
email = 'jdoe@example.org'
name = 'John Doe'

[[params.authors]]
email = 'rsmith@example.org'
name = 'Robert Smith'

Then access the values from a template:

{{ range .Params.authors }}
  {{ .name }}
  {{ .email }}
{{ end }}

What you can't do (deprecated):

{{ .Authors }}
hugocmsx009 commented 3 weeks ago

for me i just replace [author] with [params.author] thanks.