From d6873cf1b1d8c647b6bfe6178ac90263db85a54e Mon Sep 17 00:00:00 2001 From: unacro Date: Sun, 11 Aug 2024 20:45:05 +0800 Subject: [PATCH] chore: Move .Site.Author to .Site.Params.Author --- config/_default/languages.en.toml | 3 ++- exampleSite/content/docs/installation/index.it.md | 1 + exampleSite/content/docs/installation/index.ja.md | 1 + exampleSite/content/docs/installation/index.md | 1 + exampleSite/content/docs/installation/index.zh-cn.md | 1 + layouts/_default/rss.xml | 10 +++++----- layouts/_default/single.html | 2 +- layouts/partials/author-links.html | 2 +- layouts/partials/author.html | 10 +++++----- layouts/partials/footer.html | 2 +- layouts/partials/head.html | 4 ++-- layouts/partials/home/background.html | 12 ++++++------ layouts/partials/home/hero.html | 12 ++++++------ layouts/partials/home/profile.html | 10 +++++----- layouts/partials/schema.html | 4 ++-- 15 files changed, 40 insertions(+), 35 deletions(-) diff --git a/config/_default/languages.en.toml b/config/_default/languages.en.toml index 9905ea3d..846a7756 100644 --- a/config/_default/languages.en.toml +++ b/config/_default/languages.en.toml @@ -1,3 +1,4 @@ +disabled = false languageCode = "en" languageName = "English" weight = 1 @@ -13,7 +14,7 @@ title = "Blowfish" # description = "My awesome website" # copyright = "Copy, _right?_ :thinking_face:" -# [author] +# [params.author] # name = "Your name here" # email = "youremail@example.com" # image = "img/blowfish_logo.png" diff --git a/exampleSite/content/docs/installation/index.it.md b/exampleSite/content/docs/installation/index.it.md index 61cf00d9..7fbfa620 100644 --- a/exampleSite/content/docs/installation/index.it.md +++ b/exampleSite/content/docs/installation/index.it.md @@ -110,6 +110,7 @@ Per questo metodo utilizzerai Hugo per gestire i tuoi temi. Hugo utilizza **Go** ```toml [[imports]] + disable = false path = "github.com/nunocoracao/blowfish/v2" ``` diff --git a/exampleSite/content/docs/installation/index.ja.md b/exampleSite/content/docs/installation/index.ja.md index a0504aed..475197b8 100644 --- a/exampleSite/content/docs/installation/index.ja.md +++ b/exampleSite/content/docs/installation/index.ja.md @@ -111,6 +111,7 @@ For this method you'll use Hugo to manage your themes. Hugo uses **Go** to initi ```toml [[imports]] + disable = false path = "github.com/nunocoracao/blowfish/v2" ``` diff --git a/exampleSite/content/docs/installation/index.md b/exampleSite/content/docs/installation/index.md index a0504aed..475197b8 100644 --- a/exampleSite/content/docs/installation/index.md +++ b/exampleSite/content/docs/installation/index.md @@ -111,6 +111,7 @@ For this method you'll use Hugo to manage your themes. Hugo uses **Go** to initi ```toml [[imports]] + disable = false path = "github.com/nunocoracao/blowfish/v2" ``` diff --git a/exampleSite/content/docs/installation/index.zh-cn.md b/exampleSite/content/docs/installation/index.zh-cn.md index 52992f01..0f9d1c47 100644 --- a/exampleSite/content/docs/installation/index.zh-cn.md +++ b/exampleSite/content/docs/installation/index.zh-cn.md @@ -110,6 +110,7 @@ git submodule add -b main https://github.com/nunocoracao/blowfish.git themes/blo ```toml [[imports]] + disable = false path = "github.com/nunocoracao/blowfish/v2" ``` diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 741dcd79..eab24093 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -17,11 +17,11 @@ {{ .Permalink }} Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} Hugo -- gohugo.io - {{ site.LanguageCode }}{{ with .Site.Author.email }} - {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} - {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} + {{ site.LanguageCode }}{{ with .Site.Params.Author.email }} + {{.}}{{ with $.Site.Params.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Params.Author.email }} + {{.}}{{ with $.Site.Params.Author.name }} ({{.}}){{end}}{{end}} {{ if .Site.Params.footer.showCopyright | default true -}} - {{ with replace .Site.Params.copyright "{ year }" now.Year }}{{.}}{{ else }}© {{ now.Format "2006" }} {{ .Site.Author.name }}{{- end }} + {{ with replace .Site.Params.copyright "{ year }" now.Year }}{{.}}{{ else }}© {{ now.Format "2006" }} {{ .Site.Params.Author.name }}{{- end }} {{- end }} {{ if not .Date.IsZero }}{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} {{- with .OutputFormats.Get "RSS" -}} @@ -32,7 +32,7 @@ {{ .Title }} {{ .Permalink }} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} + {{ with .Site.Params.Author.email }}{{.}}{{ with $.Site.Params.Author.name }} ({{.}}){{end}}{{end}} {{ .Permalink }} {{ .Summary | html }} {{ range ( where .Site.RegularPages ".RelPermalink" .RelPermalink | first 1 ) }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 17718903..c0de7c41 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -87,7 +87,7 @@ + href="mailto:{{ .Site.Params.Author.email }}?subject={{ replace (printf "Reply to %s" .Title) "\"" "'" }}"> Reply by Email diff --git a/layouts/partials/author-links.html b/layouts/partials/author-links.html index 745c0d16..7ea84e60 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 53fd9bea..233f0e1b 100644 --- a/layouts/partials/author.html +++ b/layouts/partials/author.html @@ -1,6 +1,6 @@ {{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }}
- {{ with .Site.Author.image }} + {{ with .Site.Params.Author.image }} {{ $authorImage := "" }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} {{ $authorImage = resources.GetRemote . }} @@ -12,18 +12,18 @@ {{ $authorImage = $authorImage.Fill "192x192" }} {{ end }} {{ $.Site.Author.name | default + alt="{{ $.Site.Params.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" /> {{ else }} {{ $authorImage := resources.GetRemote . }} {{ if not $disableImageOptimization }} {{ $authorImage = $authorImage.Fill "192x192" }} {{ end }} {{ $.Site.Author.name | default + alt="{{ $.Site.Params.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" /> {{ end }} {{ end }}
- {{ with .Site.Author.name | markdownify }} + {{ with .Site.Params.Author.name | markdownify }}
{{ i18n "author.byline_title" | markdownify }}
@@ -31,7 +31,7 @@ {{ . }}
{{ end }} - {{ with .Site.Author.bio | markdownify }} + {{ with .Site.Params.Author.bio | markdownify }}
{{ . }}
{{ end }}
{{ partialCached "author-links.html" . }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index d31cecd1..cce8ae9d 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -31,7 +31,7 @@ {{- else }} © {{ now.Format "2006" }} - {{ .Site.Author.name | markdownify }} + {{ .Site.Params.Author.name | markdownify }} {{- end }}

{{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 4540753b..a1c4b300 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -105,9 +105,9 @@ {{/* Schema */}} {{ partial "schema.html" . }} {{/* Me */}} - {{ with .Site.Author.name }} + {{ with .Site.Params.Author.name }} {{ end }} - {{ with .Site.Author.links }} + {{ with .Site.Params.Author.links }} {{ range $links := . }} {{ range $name, $url := $links }} {{ end }} diff --git a/layouts/partials/home/background.html b/layouts/partials/home/background.html index d1cfa9ba..3ba55dc8 100644 --- a/layouts/partials/home/background.html +++ b/layouts/partials/home/background.html @@ -31,7 +31,7 @@ {{ end }}
- {{ with .Site.Author.image }} + {{ with .Site.Params.Author.image }} {{ $authorImage := "" }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} {{ $authorImage = resources.GetRemote . }} @@ -40,22 +40,22 @@ {{ end }} {{ if $authorImage }} {{ if not $disableImageOptimization }} - {{ $authorImage = $authorImage.Fill (print "288x288 q" ( $.Site.Author.imagequality | default "96" )) }} + {{ $authorImage = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }} {{ end }} {{ $.Site.Author.name | default + 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 }}

{{ end }}
- {{ with .Site.Author.links }} + {{ with .Site.Params.Author.links }}
{{ range $links := . }} {{ range $name, $url := $links }} diff --git a/layouts/partials/home/hero.html b/layouts/partials/home/hero.html index 50a64fad..6f5be3a4 100644 --- a/layouts/partials/home/hero.html +++ b/layouts/partials/home/hero.html @@ -28,7 +28,7 @@ {{ end }}
- {{ with .Site.Author.image }} + {{ with .Site.Params.Author.image }} {{ $authorImage := "" }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} {{ $authorImage = resources.GetRemote . }} @@ -37,22 +37,22 @@ {{ end }} {{ if $authorImage }} {{ if not $disableImageOptimization }} - {{ $authorImage = $authorImage.Fill (print "288x288 q" ( $.Site.Author.imagequality | default "96" )) }} + {{ $authorImage = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }} {{ end }} {{ $.Site.Author.name | default + 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 }}

{{ end }}
- {{ with .Site.Author.links }} + {{ with .Site.Params.Author.links }}
{{ range $links := . }} {{ range $name, $url := $links }} diff --git a/layouts/partials/home/profile.html b/layouts/partials/home/profile.html index 93732ea0..e415db19 100644 --- a/layouts/partials/home/profile.html +++ b/layouts/partials/home/profile.html @@ -3,7 +3,7 @@ h-full {{ end }} flex flex-col items-center justify-center text-center">
- {{ with .Site.Author.image }} + {{ with .Site.Params.Author.image }} {{ $authorImage := "" }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} {{ $authorImage = resources.GetRemote . }} @@ -12,16 +12,16 @@ {{ end }} {{ if $authorImage }} {{ if not $disableImageOptimization }} - {{ $authorImage = $authorImage.Fill (print "288x288 q" ( $.Site.Author.imagequality | default "96" )) }} + {{ $authorImage = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }} {{ end }} - {{ $.Site.Author.name | default {{ 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 }}

diff --git a/layouts/partials/schema.html b/layouts/partials/schema.html index 77ecfa3c..04e4e7ac 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 }}