diff options
| author | Serghei Iakovlev <egrep@protonmail.ch> | 2024-04-14 15:30:44 +0200 |
|---|---|---|
| committer | Serghei Iakovlev <egrep@protonmail.ch> | 2024-04-14 15:38:50 +0200 |
| commit | 23d77288040ca113dbc797aa2eaff6ba2a32f324 (patch) | |
| tree | c14a8417684dd54ea7425f7bc64d52d315973ad4 /layouts/partials/site-author.html | |
| parent | 77b73fceb49bff397dab6badb7df8e821960fe2b (diff) | |
| download | gohugo-theme-ed-23d77288040ca113dbc797aa2eaff6ba2a32f324.tar.gz | |
Move site author configuration to params
Diffstat (limited to 'layouts/partials/site-author.html')
| -rw-r--r-- | layouts/partials/site-author.html | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/layouts/partials/site-author.html b/layouts/partials/site-author.html new file mode 100644 index 0000000..1ddd06c --- /dev/null +++ b/layouts/partials/site-author.html @@ -0,0 +1,34 @@ +{{- /* + +This partial is used to get the site author information. + +In Hugo v0.124.0, the site.Author variable was deprecated. Instead, it is recommended to use +the "author" parameters in the site configuration file. + +This partial checks for the presence of author information in both site.Author and site.Params.author. +If both are present, preference is given to site.Params.author. + +The result is stored in the $siteAuthor variable and returned by the partial. + +Usage: + + {{ $siteAuthor := partial "site-author.html" . }} + + {{ with $siteAuthor.name }} {{ . }} {{ end }} + {{ with $siteAuthor.email }} {{ . }} {{ end }} + {{ with $siteAuthor.github }} {{ . }} {{ end }} + {{ with $siteAuthor.twitter }} {{ . }} {{ end }} + {{ with $siteAuthor.location }} {{ . }} {{ end }} + +For more information, see: https://github.com/gohugoio/hugo/releases/tag/v0.124.0 +*/ -}} + +{{- $siteAuthor := dict "name" "" "email" "" "github" "" "twitter" "" "location" "" -}} + +{{- if site.Params.author -}} + {{- $siteAuthor = merge $siteAuthor site.Params.author -}} +{{- else if site.Author -}} + {{- $siteAuthor = merge $siteAuthor site.Author -}} +{{- end -}} + +{{- return $siteAuthor -}} |
