Feat: add params.withSiteTitle and params.titleDelimiter to resolve #395

This commit is contained in:
Cell
2023-12-28 15:59:01 +08:00
parent 7aface4334
commit fbe58346e5
15 changed files with 42 additions and 17 deletions
+1 -1
Submodule docs updated: ead0f88b22...f3e1a05a22
+5
View File
@@ -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 dont, as this is a good way to watch FixIt's popularity on the rise.
disableThemeInject = false
+2 -1
View File
@@ -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" -}}
+3 -2
View File
@@ -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" -}}
+4 -1
View File
@@ -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" -}}
+4 -1
View File
@@ -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" -}}
+2 -1
View File
@@ -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" -}}
+4 -1
View File
@@ -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" -}}
+2 -1
View File
@@ -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" -}}
+3 -3
View File
@@ -17,13 +17,13 @@
<span id="{{ $id }}" class="typeit"></span>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- else -}}
<span class="header-title-text">{{- .name -}}</span>
<span class="header-title-text">{{ .name | default $.Site.Title }}</span>
{{- end -}}
{{- with .post -}}
<span class="header-title-post">{{ . | safeHTML }}</span>
{{- end -}}
{{- else -}}
<span class="header-title-text">{{- .Site.Title -}}</span>
<span class="header-title-text">{{ .Site.Title }}</span>
{{- end -}}
</a>
{{- with .Site.Params.header.subtitle -}}
@@ -32,7 +32,7 @@
<span id="{{ $id }}" class="typeit header-subtitle"></span>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- else -}}
<span class="header-subtitle">{{- .name -}}</span>
<span class="header-subtitle">{{ .name }}</span>
{{- end -}}
{{- end -}}
</div>
+2 -1
View File
@@ -1,7 +1,8 @@
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>
{{- .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 -}}
</title>
<link>
{{- .Permalink -}}
+4 -1
View File
@@ -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" -}}
+2 -1
View File
@@ -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" -}}
+2 -1
View File
@@ -1,7 +1,8 @@
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<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 -}}
</title>
<link>
{{- .Permalink -}}
+2 -1
View File
@@ -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" -}}