gohugoio / hugoBasicExample

MIT License
281 stars 281 forks source link

.Site.Author requires a map, this repo uses a flat "author = " variable #69

Closed danielfdickinson closed 3 years ago

danielfdickinson commented 3 years ago

Summary

This issue is being created with the intent for myself ( @danielfdickinson ) to create a PR to fix it, shortly.

The problem in a nutshell is that https://github.com/gohugoio/hugoBasicExample/blob/00188bc80985f84f6ee85e41f533dd4a19cae169/config.toml#L3 is a 'flat' (scalar) variable but .Site.Author expects a map.

Discussion

During a thread on the Hugo forum called .Site.Author Usage?, it was pointed out that the docs say .Site.Author expects config.toml to have an author map .

This repo has author = "Steve Francia"

https://github.com/gohugoio/hugoBasicExample/blob/00188bc80985f84f6ee85e41f533dd4a19cae169/config.toml#L3

which is a 'flat' (scalar) variable, which as far .Site.Author is concerned is an empty map (as verified with a testing).

In addition, apparently the internal RSS template expects a map which has 'name' and 'email' as keys

E.g.

[author]
name = "Your Name"
email = "you@yexample.com"

Further, .Site.Author can handle having an 'authors' key which is a map with multiple subkeys (site-dependent values).

This is potentially useful for consistency in theme design for handling authorship.

Conclusion

The expected definition of author seems to have changed from scalar to map, and this repo should reflect that. (PR to be added later today).