From 2dd90e3d20be57c6410f29cc8568eee51c5dc680 Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Sun, 12 Nov 2023 18:52:28 +0800 Subject: [PATCH 1/5] feat: move author field to params.toml --- config/_default/languages.en.toml | 49 ------------------- config/_default/params.toml | 49 +++++++++++++++++++ exampleSite/config/_default/languages.de.toml | 11 ----- exampleSite/config/_default/languages.en.toml | 11 ----- exampleSite/config/_default/languages.es.toml | 12 ----- exampleSite/config/_default/languages.ja.toml | 12 ----- exampleSite/config/_default/params.toml | 12 +++++ .../content/docs/configuration/index.md | 10 ++-- layouts/partials/author-links.html | 2 +- layouts/partials/author.html | 8 +-- layouts/partials/footer.html | 2 +- layouts/partials/head.html | 4 +- layouts/partials/home/profile.html | 8 +-- layouts/partials/schema.html | 4 +- 14 files changed, 80 insertions(+), 114 deletions(-) diff --git a/config/_default/languages.en.toml b/config/_default/languages.en.toml index a91753aa..6d9f3ab0 100644 --- a/config/_default/languages.en.toml +++ b/config/_default/languages.en.toml @@ -11,52 +11,3 @@ title = "Congo" # mainSections = ["section1", "section2"] # description = "My awesome website" - -[author] - # name = "Your name here" - # image = "img/author.jpg" - # headline = "I'm only human" - # bio = "A little bit about you" - # links = [ - # { email = "mailto:hello@your_domain.com" }, - # { link = "https://link-to-some-website.com/" }, - # { amazon = "https://www.amazon.com/hz/wishlist/ls/wishlist-id" }, - # { apple = "https://www.apple.com" }, - # { blogger = "https://username.blogspot.com/" }, - # { codepen = "https://codepen.io/username" }, - # { dev = "https://dev.to/username" }, - # { discord = "https://discord.gg/invitecode" }, - # { dribbble = "https://dribbble.com/username" }, - # { facebook = "https://facebook.com/username" }, - # { flickr = "https://www.flickr.com/photos/username/" }, - # { foursquare = "https://foursquare.com/username" }, - # { github = "https://github.com/username" }, - # { gitlab = "https://gitlab.com/username" }, - # { google = "https://www.google.com/" }, - # { hashnode = "https://username.hashnode.dev" }, - # { instagram = "https://instagram.com/username" }, - # { keybase = "https://keybase.io/username" }, - # { kickstarter = "https://www.kickstarter.com/profile/username" }, - # { lastfm = "https://lastfm.com/user/username" }, - # { linkedin = "https://linkedin.com/in/username" }, - # { mastodon = "https://mastodon.instance/@username" }, - # { medium = "https://medium.com/username" }, - # { microsoft = "https://www.microsoft.com/" }, - # { orcid = "https://orcid.org/userid" }, - # { patreon = "https://www.patreon.com/username" }, - # { pinterest = "https://pinterest.com/username" }, - # { reddit = "https://reddit.com/user/username" }, - # { researchgate = "https://www.researchgate.net/profile/username" }, - # { slack = "https://workspace.url/team/userid" }, - # { snapchat = "https://snapchat.com/add/username" }, - # { soundcloud = "https://soundcloud.com/username" }, - # { stack-overflow = "https://stackoverflow.com/users/userid/username" }, - # { steam = "https://steamcommunity.com/profiles/userid" }, - # { telegram = "https://t.me/username" }, - # { tiktok = "https://tiktok.com/@username" }, - # { tumblr = "https://username.tumblr.com" }, - # { twitch = "https://twitch.tv/username" }, - # { whatsapp = "https://wa.me/phone-number" }, - # { x-twitter = "https://twitter.com/username" }, - # { youtube = "https://youtube.com/username" }, - # ] diff --git a/config/_default/params.toml b/config/_default/params.toml index db391cb7..b995ab1e 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -80,3 +80,52 @@ fingerprintAlgorithm = "sha256" # bing = "" # pinterest = "" # yandex = "" + +[author] + # name = "Your name here" + # image = "img/author.jpg" + # headline = "I'm only human" + # bio = "A little bit about you" + # links = [ + # { email = "mailto:hello@your_domain.com" }, + # { link = "https://link-to-some-website.com/" }, + # { amazon = "https://www.amazon.com/hz/wishlist/ls/wishlist-id" }, + # { apple = "https://www.apple.com" }, + # { blogger = "https://username.blogspot.com/" }, + # { codepen = "https://codepen.io/username" }, + # { dev = "https://dev.to/username" }, + # { discord = "https://discord.gg/invitecode" }, + # { dribbble = "https://dribbble.com/username" }, + # { facebook = "https://facebook.com/username" }, + # { flickr = "https://www.flickr.com/photos/username/" }, + # { foursquare = "https://foursquare.com/username" }, + # { github = "https://github.com/username" }, + # { gitlab = "https://gitlab.com/username" }, + # { google = "https://www.google.com/" }, + # { hashnode = "https://username.hashnode.dev" }, + # { instagram = "https://instagram.com/username" }, + # { keybase = "https://keybase.io/username" }, + # { kickstarter = "https://www.kickstarter.com/profile/username" }, + # { lastfm = "https://lastfm.com/user/username" }, + # { linkedin = "https://linkedin.com/in/username" }, + # { mastodon = "https://mastodon.instance/@username" }, + # { medium = "https://medium.com/username" }, + # { microsoft = "https://www.microsoft.com/" }, + # { orcid = "https://orcid.org/userid" }, + # { patreon = "https://www.patreon.com/username" }, + # { pinterest = "https://pinterest.com/username" }, + # { reddit = "https://reddit.com/user/username" }, + # { researchgate = "https://www.researchgate.net/profile/username" }, + # { slack = "https://workspace.url/team/userid" }, + # { snapchat = "https://snapchat.com/add/username" }, + # { soundcloud = "https://soundcloud.com/username" }, + # { stack-overflow = "https://stackoverflow.com/users/userid/username" }, + # { steam = "https://steamcommunity.com/profiles/userid" }, + # { telegram = "https://t.me/username" }, + # { tiktok = "https://tiktok.com/@username" }, + # { tumblr = "https://username.tumblr.com" }, + # { twitch = "https://twitch.tv/username" }, + # { whatsapp = "https://wa.me/phone-number" }, + # { x-twitter = "https://twitter.com/username" }, + # { youtube = "https://youtube.com/username" }, + # ] diff --git a/exampleSite/config/_default/languages.de.toml b/exampleSite/config/_default/languages.de.toml index dc8775b1..3e30366d 100644 --- a/exampleSite/config/_default/languages.de.toml +++ b/exampleSite/config/_default/languages.de.toml @@ -12,14 +12,3 @@ copyright = "© 2023 Congo contributors" mainSections = ["samples"] description = "Ein leistungsstarkes, leichtgewichtiges Theme für Hugo, das mit Tailwind CSS erstellt wurde." -[author] - name = "Congo" - image = "img/author.jpg" - headline = "Nicht dein Durschnitts-Theme!" - bio = "Dies ist ein Beispiel für eine Autorenbiografie, und obwohl hier ein Stockfoto eines Hundes zu sehen ist, wurde dieser Artikel tatsächlich von einem Menschen verfasst. :dog:" - links = [ - { x-twitter = "https://twitter.com/" }, - { facebook = "https://facebook.com/" }, - { linkedin = "https://linkedin.com/" }, - { youtube = "https://youtube.com/" }, - ] diff --git a/exampleSite/config/_default/languages.en.toml b/exampleSite/config/_default/languages.en.toml index 5fa9c709..e0a1c63b 100644 --- a/exampleSite/config/_default/languages.en.toml +++ b/exampleSite/config/_default/languages.en.toml @@ -12,14 +12,3 @@ copyright = "© 2023 Congo contributors" mainSections = ["samples"] description = "A powerful, lightweight theme for Hugo built with Tailwind CSS." -[author] - name = "Congo" - image = "img/author.jpg" - headline = "Not your ordinary theme!" - bio = "This is an example author bio, and although there's a stock photo of a dog here, this article was actually created by a human. :dog:" - links = [ - { x-twitter = "https://twitter.com/" }, - { facebook = "https://facebook.com/" }, - { linkedin = "https://linkedin.com/" }, - { youtube = "https://youtube.com/" }, - ] diff --git a/exampleSite/config/_default/languages.es.toml b/exampleSite/config/_default/languages.es.toml index b23ab754..4cc090d7 100644 --- a/exampleSite/config/_default/languages.es.toml +++ b/exampleSite/config/_default/languages.es.toml @@ -11,15 +11,3 @@ copyright = "© 2023 Congo contributors" mainSections = ["samples"] description = "Un tema poderoso y liviano para Hugo creado con Tailwind CSS." - -[author] - name = "Congo" - image = "img/author.jpg" - headline = "¡No es tu tema ordinario!" - bio = "Esta es una biografía de autor de ejemplo, y aunque aquí hay una foto de un perro, este artículo en realidad fue creado por un ser humano. :dog:" - links = [ - { x-twitter = "https://twitter.com/" }, - { facebook = "https://facebook.com/" }, - { linkedin = "https://linkedin.com/" }, - { youtube = "https://youtube.com/" }, - ] diff --git a/exampleSite/config/_default/languages.ja.toml b/exampleSite/config/_default/languages.ja.toml index f35202aa..a8fbe3b4 100644 --- a/exampleSite/config/_default/languages.ja.toml +++ b/exampleSite/config/_default/languages.ja.toml @@ -11,15 +11,3 @@ copyright = "© 2023 Congo contributors" mainSections = ["samples"] description = "Tailwind CSSをベースに開発された強力で軽量なHugo向けテーマ" - -[author] - name = "Congo" - image = "img/author.jpg" - headline = "ただならぬテーマ!" - bio = "これは著者の経歴の例で、ここには犬の画像があるが、実際には人間が作成したものである。 :dog:" - links = [ - { x-twitter = "https://twitter.com/" }, - { facebook = "https://facebook.com/" }, - { linkedin = "https://linkedin.com/" }, - { youtube = "https://youtube.com/" }, - ] diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index d828f120..9531be25 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -75,3 +75,15 @@ fingerprintAlgorithm = "sha256" # bing = "" # pinterest = "" # yandex = "" + +[author] + name = "Congo" + image = "img/author.jpg" + headline = "Not your ordinary theme!" + bio = "This is an example author bio, and although there's a stock photo of a dog here, this article was actually created by a human. :dog:" + links = [ + { x-twitter = "https://twitter.com/" }, + { facebook = "https://facebook.com/" }, + { linkedin = "https://linkedin.com/" }, + { youtube = "https://youtube.com/" }, + ] diff --git a/exampleSite/content/docs/configuration/index.md b/exampleSite/content/docs/configuration/index.md index cdb66b02..a62fa5b9 100644 --- a/exampleSite/content/docs/configuration/index.md +++ b/exampleSite/content/docs/configuration/index.md @@ -98,11 +98,6 @@ The default file can be used as a template to create additional languages, or re |`params.dateFormat`|`"2 January 2006"`|How dates are formatted in this language. Refer to the [Hugo docs](https://gohugo.io/functions/format/#gos-layout-string) for acceptable formats.| |`params.mainSections`|_Not set_|The sections that should be displayed in the recent articles list. If not provided the section with the greatest number of articles is used.| |`params.description`|_Not set_|The website description. This will be used in the site metadata.| -|`author.name`|_Not set_|The author's name. This will be displayed in article footers, and on the homepage when the profile layout is used.| -|`author.image`|_Not set_|Path to the image file of the author. The image should be a 1:1 aspect ratio and placed in the site's `assets/` folder.| -|`author.headline`|_Not set_|A Markdown string containing the author's headline. It will be displayed on the profile homepage under the author's name.| -|`author.bio`|_Not set_|A Markdown string containing the author's bio. It will be displayed in article footers.| -|`author.links`|_Not set_|The links to display alongside the author's details. The config file contains example links which can simply be uncommented to enable. The order that the links are displayed is determined by the order they appear in the array. Custom links can be added by providing corresponding SVG icon assets in `assets/icons/`.| ### Menus @@ -175,6 +170,11 @@ Many of the article defaults here can be overridden on a per article basis by sp |`verification.bing`|_Not set_|The site verification string provided by Bing to be included in the site metadata.| |`verification.pinterest`|_Not set_|The site verification string provided by Pinterest to be included in the site metadata.| |`verification.yandex`|_Not set_|The site verification string provided by Yandex to be included in the site metadata.| +|`author.name`|_Not set_|The author's name. This will be displayed in article footers, and on the homepage when the profile layout is used.| +|`author.image`|_Not set_|Path to the image file of the author. The image should be a 1:1 aspect ratio and placed in the site's `assets/` folder.| +|`author.headline`|_Not set_|A Markdown string containing the author's headline. It will be displayed on the profile homepage under the author's name.| +|`author.bio`|_Not set_|A Markdown string containing the author's bio. It will be displayed in article footers.| +|`author.links`|_Not set_|The links to display alongside the author's details. The config file contains example links which can simply be uncommented to enable. The order that the links are displayed is determined by the order they appear in the array. Custom links can be added by providing corresponding SVG icon assets in `assets/icons/`.| ## Other configuration files diff --git a/layouts/partials/author-links.html b/layouts/partials/author-links.html index 72aa4e6c..350e99b8 100644 --- a/layouts/partials/author-links.html +++ b/layouts/partials/author-links.html @@ -1,4 +1,4 @@ -{{ with .Site.Author.links }} +{{ with .Site.Params.Author.links }}
{{ range $links := . }} {{ range $name, $url := $links }} diff --git a/layouts/partials/author.html b/layouts/partials/author.html index 2d29aa82..0c3f67bb 100644 --- a/layouts/partials/author.html +++ b/layouts/partials/author.html @@ -1,6 +1,6 @@ {{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }}
- {{ with .Site.Author.image }} + {{ with .Site.Params.Author.image }} {{ $authorImage := resources.Get . }} {{ if $authorImage }} {{ $authorImage := $authorImage.Fill "192x192 Center" }} @@ -8,7 +8,7 @@ class="!mb-0 !mt-0 me-4 h-24 w-24 rounded-full" width="96" height="96" - alt="{{ $.Site.Author.name | default "Author" }}" + alt="{{ $.Site.Params.Author.name | default "Author" }}" src="{{ $authorImage.RelPermalink }}" {{ if $.Site.Params.enableImageLazyLoading | default true }} loading="lazy" @@ -17,7 +17,7 @@ {{ end }} {{ end }}
- {{ with .Site.Author.name | markdownify | emojify }} + {{ with .Site.Params.Author.name | markdownify | emojify }}
{{ i18n "author.byline_title" | markdownify | emojify }}
@@ -25,7 +25,7 @@ {{ . }}
{{ end }} - {{ with .Site.Author.bio | markdownify | emojify }} + {{ with .Site.Params.Author.bio | markdownify | emojify }}
{{ . }}
{{ end }}
{{ partialCached "author-links.html" . }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 504ebc89..13727872 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -86,7 +86,7 @@ {{- else }} © {{ now.Format "2006" }} - {{ .Site.Author.name | markdownify | emojify }} + {{ .Site.Params.Author.name | markdownify | emojify }} {{- end }}

{{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index cbae8736..98d7bdba 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -117,8 +117,8 @@ {{/* Schema */}} {{ partial "schema.html" . }} {{/* Me */}} - {{ with .Site.Author.name }}{{ end }} - {{ with .Site.Author.links }} + {{ with .Site.Params.Author.name }}{{ end }} + {{ with .Site.Params.Author.links }} {{ range $links := . }} {{ range $name, $url := $links }}{{ end }} {{ end }} diff --git a/layouts/partials/home/profile.html b/layouts/partials/home/profile.html index 77398f01..a23edc28 100644 --- a/layouts/partials/home/profile.html +++ b/layouts/partials/home/profile.html @@ -4,7 +4,7 @@ {{ end }} flex flex-col items-center justify-center text-center" >
- {{ with .Site.Author.image }} + {{ with .Site.Params.Author.image }} {{ $authorImage := resources.Get . }} {{ if $authorImage }} {{ $authorImage := $authorImage.Fill "288x288 Center" }} @@ -12,15 +12,15 @@ class="mb-2 h-36 w-36 rounded-full" width="144" height="144" - alt="{{ $.Site.Author.name | default "Author" }}" + alt="{{ $.Site.Params.Author.name | default "Author" }}" src="{{ $authorImage.RelPermalink }}" /> {{ end }} {{ end }}

- {{ .Site.Author.name | default .Site.Title }} + {{ .Site.Params.Author.name | default .Site.Title }}

- {{ with .Site.Author.headline }} + {{ with .Site.Params.Author.headline }}

{{ . | markdownify | emojify }}

diff --git a/layouts/partials/schema.html b/layouts/partials/schema.html index dee02207..7b751d60 100644 --- a/layouts/partials/schema.html +++ b/layouts/partials/schema.html @@ -11,7 +11,7 @@ {{ with .Site.Params.keywords }}"keywords": {{ . }},{{ end }} "publisher" : { "@type": "Person", - "name": "{{ .Site.Author.name | safeJS }}" + "name": "{{ .Site.Params.Author.name | safeJS }}" } } @@ -30,7 +30,7 @@ "url" : "{{ .Permalink }}", "author" : { "@type": "Person", - "name": "{{ .Site.Author.name | safeJS }}" + "name": "{{ .Site.Params.Author.name | safeJS }}" }, {{ with .PublishDate }}"copyrightYear": "{{ .Format "2006" }}",{{ end }} {{ with .Date }}"dateCreated": "{{ .Format $iso8601 }}",{{ end }} From 394a018e087a9b12b74fea4f9e114a06eeefc822 Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Sun, 12 Nov 2023 19:09:16 +0800 Subject: [PATCH 2/5] feat: add warning when config is incorrect --- exampleSite/config/_default/languages.en.toml | 1 - layouts/partials/functions/warnings.html | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/exampleSite/config/_default/languages.en.toml b/exampleSite/config/_default/languages.en.toml index e0a1c63b..a9d0adf5 100644 --- a/exampleSite/config/_default/languages.en.toml +++ b/exampleSite/config/_default/languages.en.toml @@ -11,4 +11,3 @@ copyright = "© 2023 Congo contributors" mainSections = ["samples"] description = "A powerful, lightweight theme for Hugo built with Tailwind CSS." - diff --git a/layouts/partials/functions/warnings.html b/layouts/partials/functions/warnings.html index d7cb6178..e96ab7c3 100644 --- a/layouts/partials/functions/warnings.html +++ b/layouts/partials/functions/warnings.html @@ -7,3 +7,6 @@ {{ if ne .Params.logo nil }} {{ warnf "[CONGO] Theme parameter `logo` has been renamed to `header.logo`. Please update your site configuration." }} {{ end }} +{{ if .Author }} + {{ warnf "[CONGO] Theme parameter `.Site.author` in `languages.xx.toml` has been renamed to `.Site.Params.author` in `params.toml`. Please update your site configuration." }} +{{ end }} From 4b3d31eff353cd427166dfdd8993ff807dbff4e8 Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Sat, 25 Nov 2023 12:29:10 +0800 Subject: [PATCH 3/5] fix: move param under languages.xx.toml params.author --- config/_default/languages.en.toml | 49 +++++++++++++++++++ config/_default/params.toml | 49 ------------------- exampleSite/config/_default/languages.de.toml | 11 +++++ exampleSite/config/_default/languages.en.toml | 12 +++++ exampleSite/config/_default/languages.es.toml | 12 +++++ exampleSite/config/_default/languages.ja.toml | 12 +++++ exampleSite/config/_default/params.toml | 12 ----- .../content/docs/configuration/index.md | 10 ++-- layouts/partials/author-links.html | 2 +- layouts/partials/author.html | 8 +-- layouts/partials/footer.html | 2 +- layouts/partials/functions/warnings.html | 2 +- layouts/partials/head.html | 4 +- layouts/partials/home/profile.html | 8 +-- layouts/partials/schema.html | 4 +- 15 files changed, 116 insertions(+), 81 deletions(-) diff --git a/config/_default/languages.en.toml b/config/_default/languages.en.toml index 6d9f3ab0..265387d2 100644 --- a/config/_default/languages.en.toml +++ b/config/_default/languages.en.toml @@ -11,3 +11,52 @@ title = "Congo" # mainSections = ["section1", "section2"] # description = "My awesome website" + +[params.author] + # name = "Your name here" + # image = "img/author.jpg" + # headline = "I'm only human" + # bio = "A little bit about you" + # links = [ + # { email = "mailto:hello@your_domain.com" }, + # { link = "https://link-to-some-website.com/" }, + # { amazon = "https://www.amazon.com/hz/wishlist/ls/wishlist-id" }, + # { apple = "https://www.apple.com" }, + # { blogger = "https://username.blogspot.com/" }, + # { codepen = "https://codepen.io/username" }, + # { dev = "https://dev.to/username" }, + # { discord = "https://discord.gg/invitecode" }, + # { dribbble = "https://dribbble.com/username" }, + # { facebook = "https://facebook.com/username" }, + # { flickr = "https://www.flickr.com/photos/username/" }, + # { foursquare = "https://foursquare.com/username" }, + # { github = "https://github.com/username" }, + # { gitlab = "https://gitlab.com/username" }, + # { google = "https://www.google.com/" }, + # { hashnode = "https://username.hashnode.dev" }, + # { instagram = "https://instagram.com/username" }, + # { keybase = "https://keybase.io/username" }, + # { kickstarter = "https://www.kickstarter.com/profile/username" }, + # { lastfm = "https://lastfm.com/user/username" }, + # { linkedin = "https://linkedin.com/in/username" }, + # { mastodon = "https://mastodon.instance/@username" }, + # { medium = "https://medium.com/username" }, + # { microsoft = "https://www.microsoft.com/" }, + # { orcid = "https://orcid.org/userid" }, + # { patreon = "https://www.patreon.com/username" }, + # { pinterest = "https://pinterest.com/username" }, + # { reddit = "https://reddit.com/user/username" }, + # { researchgate = "https://www.researchgate.net/profile/username" }, + # { slack = "https://workspace.url/team/userid" }, + # { snapchat = "https://snapchat.com/add/username" }, + # { soundcloud = "https://soundcloud.com/username" }, + # { stack-overflow = "https://stackoverflow.com/users/userid/username" }, + # { steam = "https://steamcommunity.com/profiles/userid" }, + # { telegram = "https://t.me/username" }, + # { tiktok = "https://tiktok.com/@username" }, + # { tumblr = "https://username.tumblr.com" }, + # { twitch = "https://twitch.tv/username" }, + # { whatsapp = "https://wa.me/phone-number" }, + # { x-twitter = "https://twitter.com/username" }, + # { youtube = "https://youtube.com/username" }, + # ] diff --git a/config/_default/params.toml b/config/_default/params.toml index b995ab1e..db391cb7 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -80,52 +80,3 @@ fingerprintAlgorithm = "sha256" # bing = "" # pinterest = "" # yandex = "" - -[author] - # name = "Your name here" - # image = "img/author.jpg" - # headline = "I'm only human" - # bio = "A little bit about you" - # links = [ - # { email = "mailto:hello@your_domain.com" }, - # { link = "https://link-to-some-website.com/" }, - # { amazon = "https://www.amazon.com/hz/wishlist/ls/wishlist-id" }, - # { apple = "https://www.apple.com" }, - # { blogger = "https://username.blogspot.com/" }, - # { codepen = "https://codepen.io/username" }, - # { dev = "https://dev.to/username" }, - # { discord = "https://discord.gg/invitecode" }, - # { dribbble = "https://dribbble.com/username" }, - # { facebook = "https://facebook.com/username" }, - # { flickr = "https://www.flickr.com/photos/username/" }, - # { foursquare = "https://foursquare.com/username" }, - # { github = "https://github.com/username" }, - # { gitlab = "https://gitlab.com/username" }, - # { google = "https://www.google.com/" }, - # { hashnode = "https://username.hashnode.dev" }, - # { instagram = "https://instagram.com/username" }, - # { keybase = "https://keybase.io/username" }, - # { kickstarter = "https://www.kickstarter.com/profile/username" }, - # { lastfm = "https://lastfm.com/user/username" }, - # { linkedin = "https://linkedin.com/in/username" }, - # { mastodon = "https://mastodon.instance/@username" }, - # { medium = "https://medium.com/username" }, - # { microsoft = "https://www.microsoft.com/" }, - # { orcid = "https://orcid.org/userid" }, - # { patreon = "https://www.patreon.com/username" }, - # { pinterest = "https://pinterest.com/username" }, - # { reddit = "https://reddit.com/user/username" }, - # { researchgate = "https://www.researchgate.net/profile/username" }, - # { slack = "https://workspace.url/team/userid" }, - # { snapchat = "https://snapchat.com/add/username" }, - # { soundcloud = "https://soundcloud.com/username" }, - # { stack-overflow = "https://stackoverflow.com/users/userid/username" }, - # { steam = "https://steamcommunity.com/profiles/userid" }, - # { telegram = "https://t.me/username" }, - # { tiktok = "https://tiktok.com/@username" }, - # { tumblr = "https://username.tumblr.com" }, - # { twitch = "https://twitch.tv/username" }, - # { whatsapp = "https://wa.me/phone-number" }, - # { x-twitter = "https://twitter.com/username" }, - # { youtube = "https://youtube.com/username" }, - # ] diff --git a/exampleSite/config/_default/languages.de.toml b/exampleSite/config/_default/languages.de.toml index 3e30366d..dbe4dee8 100644 --- a/exampleSite/config/_default/languages.de.toml +++ b/exampleSite/config/_default/languages.de.toml @@ -12,3 +12,14 @@ copyright = "© 2023 Congo contributors" mainSections = ["samples"] description = "Ein leistungsstarkes, leichtgewichtiges Theme für Hugo, das mit Tailwind CSS erstellt wurde." +[params.author] + name = "Congo" + image = "img/author.jpg" + headline = "Nicht dein Durschnitts-Theme!" + bio = "Dies ist ein Beispiel für eine Autorenbiografie, und obwohl hier ein Stockfoto eines Hundes zu sehen ist, wurde dieser Artikel tatsächlich von einem Menschen verfasst. :dog:" + links = [ + { x-twitter = "https://twitter.com/" }, + { facebook = "https://facebook.com/" }, + { linkedin = "https://linkedin.com/" }, + { youtube = "https://youtube.com/" }, + ] \ No newline at end of file diff --git a/exampleSite/config/_default/languages.en.toml b/exampleSite/config/_default/languages.en.toml index a9d0adf5..b7bf147c 100644 --- a/exampleSite/config/_default/languages.en.toml +++ b/exampleSite/config/_default/languages.en.toml @@ -11,3 +11,15 @@ copyright = "© 2023 Congo contributors" mainSections = ["samples"] description = "A powerful, lightweight theme for Hugo built with Tailwind CSS." + +[params.author] + name = "Congo" + image = "img/author.jpg" + headline = "Not your ordinary theme!" + bio = "This is an example author bio, and although there's a stock photo of a dog here, this article was actually created by a human. :dog:" + links = [ + { x-twitter = "https://twitter.com/" }, + { facebook = "https://facebook.com/" }, + { linkedin = "https://linkedin.com/" }, + { youtube = "https://youtube.com/" }, + ] \ No newline at end of file diff --git a/exampleSite/config/_default/languages.es.toml b/exampleSite/config/_default/languages.es.toml index 4cc090d7..7fda1f50 100644 --- a/exampleSite/config/_default/languages.es.toml +++ b/exampleSite/config/_default/languages.es.toml @@ -11,3 +11,15 @@ copyright = "© 2023 Congo contributors" mainSections = ["samples"] description = "Un tema poderoso y liviano para Hugo creado con Tailwind CSS." + +[params.author] + name = "Congo" + image = "img/author.jpg" + headline = "¡No es tu tema ordinario!" + bio = "Esta es una biografía de autor de ejemplo, y aunque aquí hay una foto de un perro, este artículo en realidad fue creado por un ser humano. :dog:" + links = [ + { x-twitter = "https://twitter.com/" }, + { facebook = "https://facebook.com/" }, + { linkedin = "https://linkedin.com/" }, + { youtube = "https://youtube.com/" }, + ] \ No newline at end of file diff --git a/exampleSite/config/_default/languages.ja.toml b/exampleSite/config/_default/languages.ja.toml index a8fbe3b4..87a48811 100644 --- a/exampleSite/config/_default/languages.ja.toml +++ b/exampleSite/config/_default/languages.ja.toml @@ -11,3 +11,15 @@ copyright = "© 2023 Congo contributors" mainSections = ["samples"] description = "Tailwind CSSをベースに開発された強力で軽量なHugo向けテーマ" + +[params.author] + name = "Congo" + image = "img/author.jpg" + headline = "ただならぬテーマ!" + bio = "これは著者の経歴の例で、ここには犬の画像があるが、実際には人間が作成したものである。 :dog:" + links = [ + { x-twitter = "https://twitter.com/" }, + { facebook = "https://facebook.com/" }, + { linkedin = "https://linkedin.com/" }, + { youtube = "https://youtube.com/" }, + ] diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 9531be25..d828f120 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -75,15 +75,3 @@ fingerprintAlgorithm = "sha256" # bing = "" # pinterest = "" # yandex = "" - -[author] - name = "Congo" - image = "img/author.jpg" - headline = "Not your ordinary theme!" - bio = "This is an example author bio, and although there's a stock photo of a dog here, this article was actually created by a human. :dog:" - links = [ - { x-twitter = "https://twitter.com/" }, - { facebook = "https://facebook.com/" }, - { linkedin = "https://linkedin.com/" }, - { youtube = "https://youtube.com/" }, - ] diff --git a/exampleSite/content/docs/configuration/index.md b/exampleSite/content/docs/configuration/index.md index a62fa5b9..e4962bb3 100644 --- a/exampleSite/content/docs/configuration/index.md +++ b/exampleSite/content/docs/configuration/index.md @@ -98,6 +98,11 @@ The default file can be used as a template to create additional languages, or re |`params.dateFormat`|`"2 January 2006"`|How dates are formatted in this language. Refer to the [Hugo docs](https://gohugo.io/functions/format/#gos-layout-string) for acceptable formats.| |`params.mainSections`|_Not set_|The sections that should be displayed in the recent articles list. If not provided the section with the greatest number of articles is used.| |`params.description`|_Not set_|The website description. This will be used in the site metadata.| +|`params.author.name`|_Not set_|The author's name. This will be displayed in article footers, and on the homepage when the profile layout is used.| +|`params.author.image`|_Not set_|Path to the image file of the author. The image should be a 1:1 aspect ratio and placed in the site's `assets/` folder.| +|`params.author.headline`|_Not set_|A Markdown string containing the author's headline. It will be displayed on the profile homepage under the author's name.| +|`params.author.bio`|_Not set_|A Markdown string containing the author's bio. It will be displayed in article footers.| +|`params.author.links`|_Not set_|The links to display alongside the author's details. The config file contains example links which can simply be uncommented to enable. The order that the links are displayed is determined by the order they appear in the array. Custom links can be added by providing corresponding SVG icon assets in `assets/icons/`.| ### Menus @@ -170,11 +175,6 @@ Many of the article defaults here can be overridden on a per article basis by sp |`verification.bing`|_Not set_|The site verification string provided by Bing to be included in the site metadata.| |`verification.pinterest`|_Not set_|The site verification string provided by Pinterest to be included in the site metadata.| |`verification.yandex`|_Not set_|The site verification string provided by Yandex to be included in the site metadata.| -|`author.name`|_Not set_|The author's name. This will be displayed in article footers, and on the homepage when the profile layout is used.| -|`author.image`|_Not set_|Path to the image file of the author. The image should be a 1:1 aspect ratio and placed in the site's `assets/` folder.| -|`author.headline`|_Not set_|A Markdown string containing the author's headline. It will be displayed on the profile homepage under the author's name.| -|`author.bio`|_Not set_|A Markdown string containing the author's bio. It will be displayed in article footers.| -|`author.links`|_Not set_|The links to display alongside the author's details. The config file contains example links which can simply be uncommented to enable. The order that the links are displayed is determined by the order they appear in the array. Custom links can be added by providing corresponding SVG icon assets in `assets/icons/`.| ## Other configuration files diff --git a/layouts/partials/author-links.html b/layouts/partials/author-links.html index 350e99b8..d193fd85 100644 --- a/layouts/partials/author-links.html +++ b/layouts/partials/author-links.html @@ -1,4 +1,4 @@ -{{ with .Site.Params.Author.links }} +{{ with .Site.Language.Params.Author.links }}
{{ range $links := . }} {{ range $name, $url := $links }} diff --git a/layouts/partials/author.html b/layouts/partials/author.html index 0c3f67bb..84c6e9d9 100644 --- a/layouts/partials/author.html +++ b/layouts/partials/author.html @@ -1,6 +1,6 @@ {{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }}
- {{ with .Site.Params.Author.image }} + {{ with .Site.Language.Params.Author.image }} {{ $authorImage := resources.Get . }} {{ if $authorImage }} {{ $authorImage := $authorImage.Fill "192x192 Center" }} @@ -8,7 +8,7 @@ class="!mb-0 !mt-0 me-4 h-24 w-24 rounded-full" width="96" height="96" - alt="{{ $.Site.Params.Author.name | default "Author" }}" + alt="{{ $.Site.Language.Params.Author.name | default "Author" }}" src="{{ $authorImage.RelPermalink }}" {{ if $.Site.Params.enableImageLazyLoading | default true }} loading="lazy" @@ -17,7 +17,7 @@ {{ end }} {{ end }}
- {{ with .Site.Params.Author.name | markdownify | emojify }} + {{ with .Site.Language.Params.Author.name | markdownify | emojify }}
{{ i18n "author.byline_title" | markdownify | emojify }}
@@ -25,7 +25,7 @@ {{ . }}
{{ end }} - {{ with .Site.Params.Author.bio | markdownify | emojify }} + {{ with .Site.Language.Params.Author.bio | markdownify | emojify }}
{{ . }}
{{ end }}
{{ partialCached "author-links.html" . }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 13727872..2792ae59 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -86,7 +86,7 @@ {{- else }} © {{ now.Format "2006" }} - {{ .Site.Params.Author.name | markdownify | emojify }} + {{ .Site.Language.Params.Author.name | markdownify | emojify }} {{- end }}

{{ end }} diff --git a/layouts/partials/functions/warnings.html b/layouts/partials/functions/warnings.html index e96ab7c3..90ccf79e 100644 --- a/layouts/partials/functions/warnings.html +++ b/layouts/partials/functions/warnings.html @@ -8,5 +8,5 @@ {{ warnf "[CONGO] Theme parameter `logo` has been renamed to `header.logo`. Please update your site configuration." }} {{ end }} {{ if .Author }} - {{ warnf "[CONGO] Theme parameter `.Site.author` in `languages.xx.toml` has been renamed to `.Site.Params.author` in `params.toml`. Please update your site configuration." }} + {{ warnf "[CONGO] Theme parameter `.Site.author` in `languages.xx.toml` has been renamed to `.Site.Language.Params.Author` in `params.toml`. Please update your site configuration." }} {{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 98d7bdba..27f58037 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -117,8 +117,8 @@ {{/* Schema */}} {{ partial "schema.html" . }} {{/* Me */}} - {{ with .Site.Params.Author.name }}{{ end }} - {{ with .Site.Params.Author.links }} + {{ with .Site.Language.Params.Author.name }}{{ end }} + {{ with .Site.Language.Params.Author.links }} {{ range $links := . }} {{ range $name, $url := $links }}{{ end }} {{ end }} diff --git a/layouts/partials/home/profile.html b/layouts/partials/home/profile.html index a23edc28..a9063d43 100644 --- a/layouts/partials/home/profile.html +++ b/layouts/partials/home/profile.html @@ -4,7 +4,7 @@ {{ end }} flex flex-col items-center justify-center text-center" >
- {{ with .Site.Params.Author.image }} + {{ with .Site.Language.Params.Author.image }} {{ $authorImage := resources.Get . }} {{ if $authorImage }} {{ $authorImage := $authorImage.Fill "288x288 Center" }} @@ -12,15 +12,15 @@ class="mb-2 h-36 w-36 rounded-full" width="144" height="144" - alt="{{ $.Site.Params.Author.name | default "Author" }}" + alt="{{ $.Site.Language.Params.Author.name | default "Author" }}" src="{{ $authorImage.RelPermalink }}" /> {{ end }} {{ end }}

- {{ .Site.Params.Author.name | default .Site.Title }} + {{ .Site.Language.Params.Author.name | default .Site.Title }}

- {{ with .Site.Params.Author.headline }} + {{ with .Site.Language.Params.Author.headline }}

{{ . | markdownify | emojify }}

diff --git a/layouts/partials/schema.html b/layouts/partials/schema.html index 7b751d60..1681f5f9 100644 --- a/layouts/partials/schema.html +++ b/layouts/partials/schema.html @@ -11,7 +11,7 @@ {{ with .Site.Params.keywords }}"keywords": {{ . }},{{ end }} "publisher" : { "@type": "Person", - "name": "{{ .Site.Params.Author.name | safeJS }}" + "name": "{{ .Site.Language.Params.Author.name | safeJS }}" } } @@ -30,7 +30,7 @@ "url" : "{{ .Permalink }}", "author" : { "@type": "Person", - "name": "{{ .Site.Params.Author.name | safeJS }}" + "name": "{{ .Site.Language.Params.Author.name | safeJS }}" }, {{ with .PublishDate }}"copyrightYear": "{{ .Format "2006" }}",{{ end }} {{ with .Date }}"dateCreated": "{{ .Format $iso8601 }}",{{ end }} From 8a8ae76bf25ab4765ce059dee8cea8e255daf1f2 Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Sat, 25 Nov 2023 12:51:22 +0800 Subject: [PATCH 4/5] docs: update author docs --- exampleSite/content/docs/configuration/index.ja.md | 10 +++++----- exampleSite/content/docs/getting-started/index.ja.md | 4 ++-- exampleSite/content/docs/getting-started/index.md | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/exampleSite/content/docs/configuration/index.ja.md b/exampleSite/content/docs/configuration/index.ja.md index 22febbc2..ef5e1b90 100644 --- a/exampleSite/content/docs/configuration/index.ja.md +++ b/exampleSite/content/docs/configuration/index.ja.md @@ -98,11 +98,11 @@ Congoは現在、以下の言語に対応しています: |`params.dateFormat`|`"2 January 2006"`|日付の書式。許容される書式については、[Hugo docs](https://gohugo.io/functions/format/#gos-layout-string)を参照してください。| |`params.mainSections`|_Not set_|最近の記事リストに表示するセクション。指定されていない場合は、記事の数が最も多いセクションが使われます。| |`params.description`|_Not set_|ウェブサイトの説明。これはサイトのメタデータに使用されます。| -|`author.name`|_Not set_|著者の名前。これは記事のフッターと、プロフィールレイアウトが使用されている場合にホームページに表示されます。| -|`author.image`|_Not set_|著者の画像ファイルへのパス。画像は縦横比1:1で、 `assets/` に置くこと。| -|`author.headline`|_Not set_|著者の見出しを含むMarkdown文字列。プロフィールのトップページで著者の名前の下に表示されます。| -|`author.bio`|_Not set_|著者の経歴を含むMarkdown文字列。記事のフッターに表示されます。| -|`author.links`|_Not set_|著者の詳細とともに表示するリンク。設定ファイルにはリンクの例が含まれており、コメントを外すだけで有効にすることができます。リンクが表示される順番は、配列に表示される順番によって決まります。 `assets/icons/` に対応するSVGアイコンを用意することで、カスタムリンクを追加することもできます。| +|`params.author.name`|_Not set_|著者の名前。これは記事のフッターと、プロフィールレイアウトが使用されている場合にホームページに表示されます。| +|`params.author.image`|_Not set_|著者の画像ファイルへのパス。画像は縦横比1:1で、 `assets/` に置くこと。| +|`params.author.headline`|_Not set_|著者の見出しを含むMarkdown文字列。プロフィールのトップページで著者の名前の下に表示されます。| +|`params.author.bio`|_Not set_|著者の経歴を含むMarkdown文字列。記事のフッターに表示されます。| +|`params.author.links`|_Not set_|著者の詳細とともに表示するリンク。設定ファイルにはリンクの例が含まれており、コメントを外すだけで有効にすることができます。リンクが表示される順番は、配列に表示される順番によって決まります。 `assets/icons/` に対応するSVGアイコンを用意することで、カスタムリンクを追加することもできます。| ### メニュー diff --git a/exampleSite/content/docs/getting-started/index.ja.md b/exampleSite/content/docs/getting-started/index.ja.md index 9bc25efb..47a6d7a2 100644 --- a/exampleSite/content/docs/getting-started/index.ja.md +++ b/exampleSite/content/docs/getting-started/index.ja.md @@ -38,7 +38,7 @@ languageCode = "en" title = "My awesome website" -[author] +[params.author] name = "My name" image = "img/author.jpg" headline = "A generally awesome human" @@ -48,7 +48,7 @@ links = [ ] ``` -`[author]` はウェブサイト上でどのように著者情報を表示するかを決定します。画像はサイトの `assets/` に置きましょう。リンクはリストの記述順に沿って表示されます。 +`[params.author]` はウェブサイト上でどのように著者情報を表示するかを決定します。画像はサイトの `assets/` に置きましょう。リンクはリストの記述順に沿って表示されます。 各設定に関する詳細情報は、[設定]({{< ref "configuration" >}})セクションで説明されています。 diff --git a/exampleSite/content/docs/getting-started/index.md b/exampleSite/content/docs/getting-started/index.md index 27dd1479..9e019f6f 100644 --- a/exampleSite/content/docs/getting-started/index.md +++ b/exampleSite/content/docs/getting-started/index.md @@ -38,7 +38,7 @@ The language code in the language config filename should match the `languageCode title = "My awesome website" -[author] +[params.author] name = "My name" image = "img/author.jpg" headline = "A generally awesome human" @@ -48,7 +48,7 @@ links = [ ] ``` -The `[author]` configuration determines how the author information is displayed on the website. The image should be placed in the site's `assets/` folder. Links will be displayed in the order they are listed. +The `[params.author]` configuration determines how the author information is displayed on the website. The image should be placed in the site's `assets/` folder. Links will be displayed in the order they are listed. If you need extra detail, further information about each of these configuration options, is covered in the [Configuration]({{< ref "configuration" >}}) section. From a15820cb3710e0221cd0d871b17da49b69c9e53e Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Sun, 26 Nov 2023 23:02:47 +0800 Subject: [PATCH 5/5] fix: fix warning --- layouts/partials/functions/warnings.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/partials/functions/warnings.html b/layouts/partials/functions/warnings.html index 90ccf79e..3e58f20d 100644 --- a/layouts/partials/functions/warnings.html +++ b/layouts/partials/functions/warnings.html @@ -8,5 +8,5 @@ {{ warnf "[CONGO] Theme parameter `logo` has been renamed to `header.logo`. Please update your site configuration." }} {{ end }} {{ if .Author }} - {{ warnf "[CONGO] Theme parameter `.Site.author` in `languages.xx.toml` has been renamed to `.Site.Language.Params.Author` in `params.toml`. Please update your site configuration." }} + {{ warnf "[CONGO] Theme parameter `author` block in `languages.xx.toml` has been renamed to `.params.author`. Please update your site configuration." }} {{ end }}