Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move author field to languages.xx.toml under params #704

Merged
merged 5 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: move author field to params.toml
  • Loading branch information
Jh123x committed Nov 12, 2023
commit 2dd90e3d20be57c6410f29cc8568eee51c5dc680
49 changes: 0 additions & 49 deletions config/_default/languages.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
# ]
49 changes: 49 additions & 0 deletions config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
# ]
11 changes: 0 additions & 11 deletions exampleSite/config/_default/languages.de.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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/" },
]
11 changes: 0 additions & 11 deletions exampleSite/config/_default/languages.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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/" },
]
12 changes: 0 additions & 12 deletions exampleSite/config/_default/languages.es.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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/" },
]
12 changes: 0 additions & 12 deletions exampleSite/config/_default/languages.ja.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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/" },
]
12 changes: 12 additions & 0 deletions exampleSite/config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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/" },
]
10 changes: 5 additions & 5 deletions exampleSite/content/docs/configuration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/`.|
<!-- prettier-ignore-end -->

### Menus
Expand Down Expand Up @@ -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/`.|
<!-- prettier-ignore-end -->

## Other configuration files
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/author-links.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ with .Site.Author.links }}
{{ with .Site.Params.Author.links }}
<div class="flex flex-wrap text-neutral-400 dark:text-neutral-500">
{{ range $links := . }}
{{ range $name, $url := $links }}
Expand Down
8 changes: 4 additions & 4 deletions layouts/partials/author.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }}
<div class="flex">
{{ with .Site.Author.image }}
{{ with .Site.Params.Author.image }}
{{ $authorImage := resources.Get . }}
{{ if $authorImage }}
{{ $authorImage := $authorImage.Fill "192x192 Center" }}
<img
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"
Expand All @@ -17,15 +17,15 @@
{{ end }}
{{ end }}
<div class="place-self-center">
{{ with .Site.Author.name | markdownify | emojify }}
{{ with .Site.Params.Author.name | markdownify | emojify }}
<div class="text-[0.6rem] uppercase leading-3 text-neutral-500 dark:text-neutral-400">
{{ i18n "author.byline_title" | markdownify | emojify }}
</div>
<div class="font-semibold leading-6 text-neutral-800 dark:text-neutral-300">
{{ . }}
</div>
{{ end }}
{{ with .Site.Author.bio | markdownify | emojify }}
{{ with .Site.Params.Author.bio | markdownify | emojify }}
<div class="text-sm text-neutral-700 dark:text-neutral-400">{{ . }}</div>
{{ end }}
<div class="text-2xl sm:text-lg">{{ partialCached "author-links.html" . }}</div>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
{{- else }}
&copy;
{{ now.Format "2006" }}
{{ .Site.Author.name | markdownify | emojify }}
{{ .Site.Params.Author.name | markdownify | emojify }}
{{- end }}
</p>
{{ end }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@
{{/* Schema */}}
{{ partial "schema.html" . }}
{{/* Me */}}
{{ with .Site.Author.name }}<meta name="author" content="{{ . }}" />{{ end }}
{{ with .Site.Author.links }}
{{ with .Site.Params.Author.name }}<meta name="author" content="{{ . }}" />{{ end }}
{{ with .Site.Params.Author.links }}
{{ range $links := . }}
{{ range $name, $url := $links }}<link href="{{ $url }}" rel="me" />{{ end }}
{{ end }}
Expand Down
8 changes: 4 additions & 4 deletions layouts/partials/home/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
{{ end }} flex flex-col items-center justify-center text-center"
>
<header class="mb-3 flex flex-col items-center">
{{ with .Site.Author.image }}
{{ with .Site.Params.Author.image }}
{{ $authorImage := resources.Get . }}
{{ if $authorImage }}
{{ $authorImage := $authorImage.Fill "288x288 Center" }}
<img
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 }}
<h1 class="text-4xl font-extrabold">
{{ .Site.Author.name | default .Site.Title }}
{{ .Site.Params.Author.name | default .Site.Title }}
</h1>
{{ with .Site.Author.headline }}
{{ with .Site.Params.Author.headline }}
<h2 class="text-xl text-neutral-500 dark:text-neutral-400">
{{ . | markdownify | emojify }}
</h2>
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/schema.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{{ with .Site.Params.keywords }}"keywords": {{ . }},{{ end }}
"publisher" : {
"@type": "Person",
"name": "{{ .Site.Author.name | safeJS }}"
"name": "{{ .Site.Params.Author.name | safeJS }}"
}
}
</script>
Expand All @@ -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 }}
Expand Down