diff --git a/docs b/docs index ead0f88b..f3e1a05a 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit ead0f88b2229823a0b1440882f5c63d0edecf2de +Subproject commit f3e1a05a22ea0e6e2b247416c7e2d16271b69be5 diff --git a/hugo.toml b/hugo.toml index f9c95f04..3f4b052b 100644 --- a/hugo.toml +++ b/hugo.toml @@ -275,6 +275,11 @@ enableEmoji = true externalIcon = false # FixIt 0.3.0 | NEW whether to reverse the order of the navigation menu navigationReverse = false + # FixIt 0.3.0 | NEW whether to add site title to the title of every page + # remember to set up your site title in `hugo.toml` (e.g. title = "title") + withSiteTitle = true + # FixIt 0.3.0 | NEW title delimiter when the site title is be added to the title of every page + titleDelimiter = "-" # FixIt 0.2.14 | NEW FixIt will, by default, inject a theme meta tag in the HTML head on the home page only. # You can turn it off, but we would really appreciate if you don’t, as this is a good way to watch FixIt's popularity on the rise. disableThemeInject = false diff --git a/layouts/404.html b/layouts/404.html index 19cbe648..091ea057 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,5 +1,6 @@ {{- define "title" -}} - {{- T "pageNotFound" | printf "404 %v" }} | {{ .Site.Title -}} + {{- T "pageNotFound" | printf "404 %v" -}} + {{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}} {{- end -}} {{- define "content" -}} diff --git a/layouts/_default/section.html b/layouts/_default/section.html index 41bfc4cf..eab029ba 100644 --- a/layouts/_default/section.html +++ b/layouts/_default/section.html @@ -1,5 +1,6 @@ -{{- define "title" }} - {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} | {{ .Site.Title -}} +{{- define "title" -}} + {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" -}} + {{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}} {{- end -}} {{- define "content" -}} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 0fbf128b..85320622 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,4 +1,7 @@ -{{- define "title" }}{{ .Title }} | {{ .Site.Title }}{{ end -}} +{{- define "title" -}} + {{- .Title -}} + {{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}} +{{- end -}} {{- define "content" -}} {{- $params := .Scratch.Get "params" -}} diff --git a/layouts/friends/single.html b/layouts/friends/single.html index 7befad89..4ce85a20 100644 --- a/layouts/friends/single.html +++ b/layouts/friends/single.html @@ -1,7 +1,10 @@ {{- /* TODO remove this template */ -}} {{- warnf "The `type:friends` in front matter is deprecated. Use `layout:friends` instead.\n" -}} {{- warnf "Front matter 参数 `type:friends` 已弃用。请改用 `layout:friends`。" -}} -{{- define "title" }}{{ .Title }} | {{ .Site.Title }}{{ end -}} +{{- define "title" -}} + {{- .Title -}} + {{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}} +{{ end -}} {{- define "content" -}} {{- $params := .Scratch.Get "params" -}} diff --git a/layouts/offline/single.html b/layouts/offline/single.html index 8f7dc3e4..3b80ffc5 100644 --- a/layouts/offline/single.html +++ b/layouts/offline/single.html @@ -2,7 +2,8 @@ {{- warnf "The `type:offline` in front matter is deprecated. Use `layout:offline` instead.\n" -}} {{- warnf "Front matter 参数 `type:offline` 已弃用。请改用 `layout:offline`。" -}} {{- define "title" -}} - {{- T "offlineTitle" }} | {{ .Site.Title -}} + {{- T "offlineTitle" -}} + {{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}} {{- end -}} {{- define "content" -}} diff --git a/layouts/page/friends.html b/layouts/page/friends.html index 0b15481e..6a8300db 100644 --- a/layouts/page/friends.html +++ b/layouts/page/friends.html @@ -1,4 +1,7 @@ -{{- define "title" }}{{ .Title }} | {{ .Site.Title }}{{ end -}} +{{- define "title" -}} + {{- .Title -}} + {{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}} +{{- end -}} {{- define "content" -}} {{- $params := .Scratch.Get "params" -}} diff --git a/layouts/page/offline.html b/layouts/page/offline.html index 0c46594f..3e01809f 100644 --- a/layouts/page/offline.html +++ b/layouts/page/offline.html @@ -1,5 +1,6 @@ {{- define "title" -}} - {{- T "offlineTitle" }} | {{ .Site.Title -}} + {{- T "offlineTitle" -}} + {{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}} {{- end -}} {{- define "content" -}} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 7df177b2..ed5d7e29 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -17,13 +17,13 @@ {{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}} {{- else -}} - {{- .name -}} + {{ .name | default $.Site.Title }} {{- end -}} {{- with .post -}} {{ . | safeHTML }} {{- end -}} {{- else -}} - {{- .Site.Title -}} + {{ .Site.Title }} {{- end -}} {{- with .Site.Params.header.subtitle -}} @@ -32,7 +32,7 @@ {{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}} {{- else -}} - {{- .name -}} + {{ .name }} {{- end -}} {{- end -}} diff --git a/layouts/posts/rss.xml b/layouts/posts/rss.xml index c3183aa7..f974094f 100644 --- a/layouts/posts/rss.xml +++ b/layouts/posts/rss.xml @@ -1,7 +1,8 @@ - {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} | {{ .Site.Title -}} + {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" -}} + {{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}} {{- .Permalink -}} diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 6b25964c..c84ae995 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -1,4 +1,7 @@ -{{- define "title" }}{{ .Title }} | {{ .Site.Title }}{{ end -}} +{{- define "title" -}} + {{- .Title -}} + {{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}} +{{- end -}} {{- define "content" -}} {{- $params := .Scratch.Get "params" -}} diff --git a/layouts/taxonomy/list.html b/layouts/taxonomy/list.html index ef0f8135..d95be277 100644 --- a/layouts/taxonomy/list.html +++ b/layouts/taxonomy/list.html @@ -1,5 +1,6 @@ {{- define "title" -}} - {{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} | {{ .Site.Title -}} + {{- .Title }} - {{ T .Data.Singular | default .Data.Singular -}} + {{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}} {{- end -}} {{- define "content" -}} diff --git a/layouts/taxonomy/rss.xml b/layouts/taxonomy/rss.xml index 62450a7f..d3aab8e8 100644 --- a/layouts/taxonomy/rss.xml +++ b/layouts/taxonomy/rss.xml @@ -1,7 +1,8 @@ - {{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} | {{ .Site.Title -}} + {{- .Title }} - {{ T .Data.Singular | default .Data.Singular -}} + {{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}} {{- .Permalink -}} diff --git a/layouts/taxonomy/terms.html b/layouts/taxonomy/terms.html index bd42cb85..d5984391 100644 --- a/layouts/taxonomy/terms.html +++ b/layouts/taxonomy/terms.html @@ -1,5 +1,6 @@ {{- define "title" -}} - {{- .Params.Title | default (T .Data.Plural) | default .Data.Plural | dict "Some" | T "allSome" }} | {{ .Site.Title -}} + {{- .Params.Title | default (T .Data.Plural) | default .Data.Plural | dict "Some" | T "allSome" -}} + {{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}} {{- end -}} {{- define "content" -}}