Site.Authors in internal templates

Hello,

How do I set this?

Where is that authors coming from? I would appreciate if I can see an example where this is being used. Facebook templates similarly uses this .Site.Authors

At least since the last version of Hugo (v0.16) the code base contains a first attempt to implement the author feature. The current approach allows you to define a single author in the config file. However, this setup will be removed due to it’s limitations. In the future you’ll be able to define multiple author profiles in their own files.

You can find the current implementation below. If you search on GitHub in the Hugo repository with “author” as query you’ll find all places were the current implementation is used (including your template).

You can follow the future development in the corresponding issues. You should also keep an eye on milestone v0.18.

So, basically the specific internal templates parts will not work until v0.18, right?

They should work even with the current version. You can add a author section to your config file with the fields of the struct that I linked above.

[author]
displayName = "James Bond"
shortBio = "Agent at the MI6"

Hugo will make those data available trough the .Site.Author variable in the templates.

With the search will also find the place where the author struct is embedded into the pages.

They won’t work in the current version. If you look closely at the code I linked above, it’s Authors, not Author.

.Site.Authors is actually a template function.

Nope. .Authors is the linked template function. .Site.Authors doesn’t exist.

My fault. You’re right. .Authors is the correct way to access it.

So

[authors]
twitter = "foo"

in config.toml won’t work in 0.17?

And

[author]
twitter = "foo"

also doesn’t work?

How to set it in the metadata field of a content file?