From de79ec026d049ef965fdaf9d34ae995144f8fa4e Mon Sep 17 00:00:00 2001 From: wowqing Date: Tue, 26 Mar 2024 22:32:53 +0000 Subject: [PATCH] Seo improve (#1128) * 1. Display page count for paginated titles 2. The canonical URL for pagination is the same as the page URL. * 1. Removed microdata and unified use of JSON-LD. 2. Add alternateName field to webSite schema. That is an alternate site name used in Google search results. 3. Fix missing field in google rich result test. 4. Prioritize using the featured image in front matter as the article image in JSON-LD. --------- Co-authored-by: HEIGE-PCloud --- .../theme-documentation-basics/index.en.md | 3 + .../theme-documentation-basics/index.zh-cn.md | 3 + exampleSite/config/_default/params.toml | 4 + themes/DoIt/i18n/am.toml | 8 +- themes/DoIt/i18n/ar.toml | 6 + themes/DoIt/i18n/ca.toml | 6 + themes/DoIt/i18n/de.toml | 6 + themes/DoIt/i18n/el.toml | 6 + themes/DoIt/i18n/en.toml | 6 + themes/DoIt/i18n/es.toml | 6 + themes/DoIt/i18n/fr.toml | 7 + themes/DoIt/i18n/hi.toml | 8 +- themes/DoIt/i18n/id.toml | 6 + themes/DoIt/i18n/it.toml | 6 + themes/DoIt/i18n/ko.toml | 6 + themes/DoIt/i18n/pl.toml | 6 + themes/DoIt/i18n/pt-BR.toml | 6 + themes/DoIt/i18n/pt-PT.toml | 6 + themes/DoIt/i18n/ro.toml | 6 + themes/DoIt/i18n/ru.toml | 6 + themes/DoIt/i18n/sr.toml | 6 + themes/DoIt/i18n/te.toml | 8 +- themes/DoIt/i18n/th.toml | 6 + themes/DoIt/i18n/ti.toml | 8 +- themes/DoIt/i18n/tr.toml | 6 + themes/DoIt/i18n/uk.toml | 6 + themes/DoIt/i18n/vi.toml | 6 + themes/DoIt/i18n/zh-CN.toml | 5 + themes/DoIt/i18n/zh-TW.toml | 6 + themes/DoIt/layouts/_default/baseof.html | 8 + themes/DoIt/layouts/_default/section.html | 16 +- themes/DoIt/layouts/_default/summary.html | 4 +- themes/DoIt/layouts/index.html | 23 ++- themes/DoIt/layouts/partials/footer.html | 8 +- themes/DoIt/layouts/partials/head/link.html | 6 +- .../DoIt/layouts/partials/head/paginator.html | 45 +++++ themes/DoIt/layouts/partials/head/seo.html | 182 ++++++++++++------ themes/DoIt/layouts/taxonomy/list.html | 25 +-- 38 files changed, 382 insertions(+), 109 deletions(-) create mode 100644 themes/DoIt/layouts/partials/head/paginator.html diff --git a/content/posts/theme-documentation-basics/index.en.md b/content/posts/theme-documentation-basics/index.en.md index 90284c12c..697ebeb22 100644 --- a/content/posts/theme-documentation-basics/index.en.md +++ b/content/posts/theme-documentation-basics/index.en.md @@ -779,6 +779,9 @@ Please open the code block below to view the complete sample configuration :(far image = "" # thumbnail URL thumbnailUrl = "" + # {{< version 0.4.1 >}} + # alternate site name in Google search result + alternateName = ["Hugo DoIt"] # {{< version 0.2.0 >}} Analytics config [params.analytics] diff --git a/content/posts/theme-documentation-basics/index.zh-cn.md b/content/posts/theme-documentation-basics/index.zh-cn.md index 22ff72c49..ea46cd508 100644 --- a/content/posts/theme-documentation-basics/index.zh-cn.md +++ b/content/posts/theme-documentation-basics/index.zh-cn.md @@ -783,6 +783,9 @@ optimizeImages = true image = "" # 缩略图 URL thumbnailUrl = "" + # {{< version 0.4.1 >}} + # Google 搜索结果中网站备用名字 + alternateName = ["Hugo DoIt"] # {{< version 0.2.0 >}} 网站分析配置 [params.analytics] diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 509565762..924dda791 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -557,6 +557,10 @@ srcsetLargeResizeMethod = "2000x webp Lanczos q75" # thumbnail URL # 缩略图 URL thumbnailUrl = "/images/screenshot.png" + # Google 搜索结果中网站备用名字 + # alternate site name in Google search result + # https://developers.google.com/search/docs/appearance/site-names#alternative + # alternateName = ["Hugo DoIt"] # Analytics config # 网站分析配置 diff --git a/themes/DoIt/i18n/am.toml b/themes/DoIt/i18n/am.toml index af96c51de..31af640f0 100644 --- a/themes/DoIt/i18n/am.toml +++ b/themes/DoIt/i18n/am.toml @@ -1,4 +1,4 @@ -# Translations for English +# Translations for Amharic # https://gohugo.io/content-management/multilingual/#translation-of-strings # === baseof == @@ -252,3 +252,9 @@ other = "ተለውጧል" [deleted] other = "ተሰርዟል።" # === shortcodes/version.html === + +[prefixPageNumber] +other = "ገጽ" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/ar.toml b/themes/DoIt/i18n/ar.toml index d6a79f88e..6a7725f5d 100644 --- a/themes/DoIt/i18n/ar.toml +++ b/themes/DoIt/i18n/ar.toml @@ -192,3 +192,9 @@ other = "تم تعديله" [deleted] other = "حُذف" # === shortcodes/version.html === + +[prefixPageNumber] +other = " " + +[suffixPageNumber] +other = "الصفحة" diff --git a/themes/DoIt/i18n/ca.toml b/themes/DoIt/i18n/ca.toml index 69ddfc6e5..b45781349 100644 --- a/themes/DoIt/i18n/ca.toml +++ b/themes/DoIt/i18n/ca.toml @@ -192,3 +192,9 @@ other = "CANVIAT" [deleted] other = "SUPRIMIT" # === shortcodes/version.html === + +[prefixPageNumber] +other = "Página" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/de.toml b/themes/DoIt/i18n/de.toml index 5b113e289..cef7ee10c 100644 --- a/themes/DoIt/i18n/de.toml +++ b/themes/DoIt/i18n/de.toml @@ -191,3 +191,9 @@ other = "GEÄNDERT" [deleted] other = "GELÖSCHT" # === shortcodes/version.html === + +[prefixPageNumber] +other = "Seite" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/el.toml b/themes/DoIt/i18n/el.toml index 515fec6b5..5eaf35b7d 100644 --- a/themes/DoIt/i18n/el.toml +++ b/themes/DoIt/i18n/el.toml @@ -196,3 +196,9 @@ other = "ΑΛΛΑΓΜΕΝΟ" [deleted] other = "ΔΙΑΓΡΑΜΜΕΝΟ" # === shortcodes/version.html === + +[prefixPageNumber] +other = "Σελίδα" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/en.toml b/themes/DoIt/i18n/en.toml index a7cb04aeb..202b068a3 100644 --- a/themes/DoIt/i18n/en.toml +++ b/themes/DoIt/i18n/en.toml @@ -252,3 +252,9 @@ other = "CHANGED" [deleted] other = "DELETED" # === shortcodes/version.html === + +[prefixPageNumber] +other = "Page" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/es.toml b/themes/DoIt/i18n/es.toml index 288f19628..d01eff550 100644 --- a/themes/DoIt/i18n/es.toml +++ b/themes/DoIt/i18n/es.toml @@ -235,3 +235,9 @@ other = "MODIFICADO" [deleted] other = "ELIMINADO" # === shortcodes/version.html === + +[prefixPageNumber] +other = "Página" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/fr.toml b/themes/DoIt/i18n/fr.toml index 4c4df87f1..7c3f1f248 100644 --- a/themes/DoIt/i18n/fr.toml +++ b/themes/DoIt/i18n/fr.toml @@ -256,3 +256,10 @@ other = "CHANGÉ" [deleted] other = "EFFACÉ" # === shortcodes/version.html === + +[prefixPageNumber] +other = "Page" + +[suffixPageNumber] +other = " " + diff --git a/themes/DoIt/i18n/hi.toml b/themes/DoIt/i18n/hi.toml index 26f2c930e..bf39d027e 100644 --- a/themes/DoIt/i18n/hi.toml +++ b/themes/DoIt/i18n/hi.toml @@ -191,4 +191,10 @@ other = "बदला हुआ" [deleted] other = "हटाए गए" -# === shortcodes/version.html === \ No newline at end of file +# === shortcodes/version.html === + +[prefixPageNumber] +other = "पृष्ठ" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/id.toml b/themes/DoIt/i18n/id.toml index 72da3d83f..fefd9b8b5 100644 --- a/themes/DoIt/i18n/id.toml +++ b/themes/DoIt/i18n/id.toml @@ -192,3 +192,9 @@ other = "BERUBAH" [deleted] other = "DIHAPUS" # === shortcodes/version.html === + +[prefixPageNumber] +other = "Halaman" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/it.toml b/themes/DoIt/i18n/it.toml index e074b03ce..20b8ee7a8 100644 --- a/themes/DoIt/i18n/it.toml +++ b/themes/DoIt/i18n/it.toml @@ -191,3 +191,9 @@ other = "CAMBIATO" [deleted] other = "CANCELLATO" # === shortcodes/version.html === + +[prefixPageNumber] +other = "Pagina" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/ko.toml b/themes/DoIt/i18n/ko.toml index 83cc97031..85af682c5 100644 --- a/themes/DoIt/i18n/ko.toml +++ b/themes/DoIt/i18n/ko.toml @@ -218,3 +218,9 @@ other = "변경" [deleted] other = "삭제" # === shortcodes/version.html === + +[prefixPageNumber] +other = " " + +[suffixPageNumber] +other = "페이지" diff --git a/themes/DoIt/i18n/pl.toml b/themes/DoIt/i18n/pl.toml index 0743c5bab..6e5222c95 100644 --- a/themes/DoIt/i18n/pl.toml +++ b/themes/DoIt/i18n/pl.toml @@ -191,3 +191,9 @@ other = "Zmieniono" [deleted] other = "Usunięte" # === shortcodes/version.html === + +[prefixPageNumber] +other = "Strona" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/pt-BR.toml b/themes/DoIt/i18n/pt-BR.toml index f9db82ad6..929ccd8d7 100644 --- a/themes/DoIt/i18n/pt-BR.toml +++ b/themes/DoIt/i18n/pt-BR.toml @@ -251,3 +251,9 @@ other = "ALTERADO" [deleted] other = "EXCLUÍDO" # === shortcodes/version.html === + +[prefixPageNumber] +other = "Página" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/pt-PT.toml b/themes/DoIt/i18n/pt-PT.toml index 47d50f6ba..21bf77390 100644 --- a/themes/DoIt/i18n/pt-PT.toml +++ b/themes/DoIt/i18n/pt-PT.toml @@ -251,3 +251,9 @@ other = "ALTERADO" [deleted] other = "EXCLUÍDO" # === shortcodes/version.html === + +[prefixPageNumber] +other = "Página" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/ro.toml b/themes/DoIt/i18n/ro.toml index 1b80587d9..d5033b6af 100644 --- a/themes/DoIt/i18n/ro.toml +++ b/themes/DoIt/i18n/ro.toml @@ -191,3 +191,9 @@ other = "SCHIMBAT" [deleted] other = "ȘTERS" # === shortcodes/version.html === + +[prefixPageNumber] +other = "Pagină" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/ru.toml b/themes/DoIt/i18n/ru.toml index 662a76dec..9d1fef82c 100644 --- a/themes/DoIt/i18n/ru.toml +++ b/themes/DoIt/i18n/ru.toml @@ -252,3 +252,9 @@ other = "ИЗМЕНЕН" [deleted] other = "УДАЛЕН" # === shortcodes/version.html === + +[prefixPageNumber] +other = "Стр." + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/sr.toml b/themes/DoIt/i18n/sr.toml index 39ebd91f3..fbd0713ef 100644 --- a/themes/DoIt/i18n/sr.toml +++ b/themes/DoIt/i18n/sr.toml @@ -191,3 +191,9 @@ other = "ПРОМЕЊЕНО" [deleted] other = "ОБРИСАНО" # === shortcodes/version.html === + +[prefixPageNumber] +other = "Страница" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/te.toml b/themes/DoIt/i18n/te.toml index 4104e2af3..42ad41300 100644 --- a/themes/DoIt/i18n/te.toml +++ b/themes/DoIt/i18n/te.toml @@ -192,4 +192,10 @@ other = "మార్చబడింది" [deleted] other = "తొలగించిన" -# === shortcodes/version.html === \ No newline at end of file +# === shortcodes/version.html === + +[prefixPageNumber] +other = "పుట" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/th.toml b/themes/DoIt/i18n/th.toml index d0e3f25fe..3ddff9db6 100644 --- a/themes/DoIt/i18n/th.toml +++ b/themes/DoIt/i18n/th.toml @@ -192,3 +192,9 @@ other = "เปลี่ยนแปลง" [deleted] other = "ลบ" # === shortcodes/version.html === + +[prefixPageNumber] +other = "หน้า" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/ti.toml b/themes/DoIt/i18n/ti.toml index 2fd7df56f..6ed081681 100644 --- a/themes/DoIt/i18n/ti.toml +++ b/themes/DoIt/i18n/ti.toml @@ -1,4 +1,4 @@ -# Translations for English +# Translations for Tigrinya # https://gohugo.io/content-management/multilingual/#translation-of-strings # === baseof == @@ -252,3 +252,9 @@ other = "ተለዊጡ" [deleted] other = "ተደምሲሱ" # === shortcodes/version.html === + +[prefixPageNumber] +other = "ስራሕ" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/tr.toml b/themes/DoIt/i18n/tr.toml index 6df8c630e..31345cf1c 100644 --- a/themes/DoIt/i18n/tr.toml +++ b/themes/DoIt/i18n/tr.toml @@ -253,3 +253,9 @@ other = "DEĞİŞTİRİLDİ" [deleted] other = "SİLİNDİ" # === shortcodes/version.html === + +[prefixPageNumber] +other = "Sayfa" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/uk.toml b/themes/DoIt/i18n/uk.toml index 1b6eb5c3c..a765f6b59 100644 --- a/themes/DoIt/i18n/uk.toml +++ b/themes/DoIt/i18n/uk.toml @@ -193,3 +193,9 @@ other = "ЗМІНЕНИЙ" [deleted] other = "ВИДАЛЕНИЙ" # === shortcodes/version.html === + +[prefixPageNumber] +other = "Cторінка" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/vi.toml b/themes/DoIt/i18n/vi.toml index 2a5da99eb..52a2d8924 100644 --- a/themes/DoIt/i18n/vi.toml +++ b/themes/DoIt/i18n/vi.toml @@ -252,3 +252,9 @@ other = "THAY ĐỔI" [deleted] other = "XOÁ" # === shortcodes/version.html === + +[prefixPageNumber] +other = "Trang" + +[suffixPageNumber] +other = " " diff --git a/themes/DoIt/i18n/zh-CN.toml b/themes/DoIt/i18n/zh-CN.toml index 67f0c851a..acc51cf30 100644 --- a/themes/DoIt/i18n/zh-CN.toml +++ b/themes/DoIt/i18n/zh-CN.toml @@ -251,3 +251,8 @@ other = "更改" other = "删除" # === shortcodes/version.html === +[prefixPageNumber] +other = "第" + +[suffixPageNumber] +other = "页" diff --git a/themes/DoIt/i18n/zh-TW.toml b/themes/DoIt/i18n/zh-TW.toml index 427d566dd..643b63b53 100644 --- a/themes/DoIt/i18n/zh-TW.toml +++ b/themes/DoIt/i18n/zh-TW.toml @@ -189,3 +189,9 @@ other = "更改" [deleted] other = "刪除" # === shortcodes/version.html === + +[prefixPageNumber] +other = "第" + +[suffixPageNumber] +other = "頁" diff --git a/themes/DoIt/layouts/_default/baseof.html b/themes/DoIt/layouts/_default/baseof.html index fe4c7c9ba..abcd6f9f2 100644 --- a/themes/DoIt/layouts/_default/baseof.html +++ b/themes/DoIt/layouts/_default/baseof.html @@ -7,6 +7,14 @@ + + {{- /* Paginate */ -}} + {{- /* Paginate in here, To solve the problem of the canonical URL being the same in the pagination */ -}} + {{- /* see more https://github.com/gohugoio/hugo/issues/4507 */ -}} + {{- /* see more https://discourse.gohugo.io/t/control-pagination-and-page-collections-from-baseof-html/37643/8 */ -}} + {{- /* see more https://discourse.gohugo.io/t/determine-if-current-page-is-result-of-pagination/37494/4 */ -}} + {{- partial "head/paginator.html" . -}} + {{- block "title" . }}{{ .Site.Title }}{{ end -}} diff --git a/themes/DoIt/layouts/_default/section.html b/themes/DoIt/layouts/_default/section.html index 186601626..b6ba5ef0b 100644 --- a/themes/DoIt/layouts/_default/section.html +++ b/themes/DoIt/layouts/_default/section.html @@ -1,5 +1,10 @@ {{- define "title" }} - {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} - {{ .Site.Title -}} + {{- if (gt .Paginator.PageNumber 1) -}} + {{ $pageNumber := printf "%v %v %v" (T "prefixPageNumber" ) .Paginator.PageNumber (T "suffixPageNumber" ) }} + {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} {{ $pageNumber }} - {{ .Site.Title -}} + {{- else -}} + {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} - {{ .Site.Title -}} + {{- end -}} {{- end -}} {{- define "content" -}} @@ -10,15 +15,10 @@

{{- /* Paginate */ -}} + {{- /* Paginate is first call on baseof.html */ -}} {{- if .Pages -}} - {{- $pages := .Pages.GroupByDate "2006" -}} - {{- with .Site.Params.section.paginate | default .Site.Params.paginate -}} - {{- $pages = $.Paginate $pages . -}} - {{- else -}} - {{- $pages = .Paginate $pages -}} - {{- end -}} {{- partial "recentlyUpdated.html" . -}} - {{- range $pages.PageGroups -}} + {{- range .Paginator.PageGroups -}}

{{ .Key }}

{{- range .Pages -}}
diff --git a/themes/DoIt/layouts/_default/summary.html b/themes/DoIt/layouts/_default/summary.html index 459c87717..bae876ab5 100644 --- a/themes/DoIt/layouts/_default/summary.html +++ b/themes/DoIt/layouts/_default/summary.html @@ -1,6 +1,6 @@ {{- $params := .Params | merge .Site.Params.page -}} -
+
{{- /* Featured image */ -}} {{- $image := $params.featuredImagePreview | default $params.featuredImage -}} {{- with $image -}} @@ -12,7 +12,7 @@ {{- end -}} {{- /* Title */ -}} -

+

{{ .Title }}

diff --git a/themes/DoIt/layouts/index.html b/themes/DoIt/layouts/index.html index d603a9825..d871d53a6 100644 --- a/themes/DoIt/layouts/index.html +++ b/themes/DoIt/layouts/index.html @@ -1,3 +1,12 @@ +{{- define "title" }} + {{- $paginatorPager := .Scratch.Get "paginatorPager" -}} + {{- if and $paginatorPager (gt $paginatorPager.PageNumber 1) -}} + {{- T "prefixPageNumber" }} {{ $paginatorPager.PageNumber }} {{ T "suffixPageNumber" }} - {{ $.Site.Title -}} + {{ else }} + {{- $.Site.Title -}} + {{- end -}} +{{- end -}} + {{- define "content" -}} {{- $params := .Scratch.Get "params" -}} {{- $profile := .Site.Params.home.profile -}} @@ -21,18 +30,8 @@ {{- /* Posts */ -}} {{- if ne $posts.enable false | and .Site.RegularPages -}} {{- /* Paginate */ -}} - {{- $pages := where .Site.RegularPages "Type" "in" site.Params.mainSections -}} - {{- if .Site.Params.page.hiddenFromHomePage -}} - {{- $pages = where $pages "Params.hiddenfromhomepage" false -}} - {{- else -}} - {{- $pages = where $pages "Params.hiddenfromhomepage" "!=" true -}} - {{- end -}} - {{- with $posts.paginate | default .Site.Params.paginate -}} - {{- $pages = $.Paginate $pages . -}} - {{- else -}} - {{- $pages = .Paginate $pages -}} - {{- end -}} - {{- range $pages.Pages -}} + {{- /* Paginate is first call on baseof.html */ -}} + {{- range .Paginator.Pages -}} {{- .Render "summary" -}} {{- end -}} {{- partial "paginator.html" . -}} diff --git a/themes/DoIt/layouts/partials/footer.html b/themes/DoIt/layouts/partials/footer.html index 27f47d12b..ca2fa1438 100644 --- a/themes/DoIt/layouts/partials/footer.html +++ b/themes/DoIt/layouts/partials/footer.html @@ -34,17 +34,15 @@ {{- if ne .Site.Params.footer.copyright false -}} {{- with .Site.Params.footer.since -}} - - {{- if lt . now.Year }}{{ . }} - {{ end }}{{ now.Year -}} - + {{- if lt . now.Year }}{{ . }} - {{ end }}{{ now.Year -}} {{- else -}} - {{ now.Year }} + {{ now.Year }} {{- end -}} {{- end -}} {{- /* Author */ -}} {{- if ne .Site.Params.footer.author false -}} -  {{ .Site.Author.name }} +  {{ .Site.Author.name }} {{- end -}} {{- /* License */ -}} diff --git a/themes/DoIt/layouts/partials/head/link.html b/themes/DoIt/layouts/partials/head/link.html index 432e8b36b..8cdcd41a9 100644 --- a/themes/DoIt/layouts/partials/head/link.html +++ b/themes/DoIt/layouts/partials/head/link.html @@ -18,7 +18,11 @@ {{- end -}} {{- end -}} - +{{ $canonicalURL := .Permalink }} +{{ with .Scratch.Get "paginatorPager" }} + {{ $canonicalURL = .URL | absLangURL }} +{{ end }} + {{- if .PrevInSection -}} {{- end -}} diff --git a/themes/DoIt/layouts/partials/head/paginator.html b/themes/DoIt/layouts/partials/head/paginator.html new file mode 100644 index 000000000..7cf9e0332 --- /dev/null +++ b/themes/DoIt/layouts/partials/head/paginator.html @@ -0,0 +1,45 @@ +{{- if .IsHome -}} + {{- $posts := .Site.Params.home.posts -}} + {{- if ne $posts.enable false | and .Site.RegularPages -}} + {{- $pages := where .Site.RegularPages "Type" "in" site.Params.mainSections -}} + {{- if .Site.Params.page.hiddenFromHomePage -}} + {{- $pages = where $pages "Params.hiddenfromhomepage" false -}} + {{- else -}} + {{- $pages = where $pages "Params.hiddenfromhomepage" "!=" true -}} + {{- end -}} + {{- with $posts.paginate | default .Site.Params.paginate -}} + {{- $pages = $.Paginate $pages . -}} + {{- else -}} + {{- $pages = .Paginate $pages -}} + {{- end -}} + {{- .Scratch.Set "paginatorPager" $pages -}} + {{- end -}} + +{{- else if and .IsSection .Pages -}} + {{- $pages := .Pages.GroupByDate "2006" -}} + {{- with .Site.Params.section.paginate | default .Site.Params.paginate -}} + {{- $pages = $.Paginate $pages . -}} + {{- else -}} + {{- $pages = .Paginate $pages -}} + {{- end -}} + {{- .Scratch.Set "paginatorPager" $pages -}} +{{- else if and (eq .Kind "term") .Pages -}} + {{- $taxonomy := .Data.Singular -}} + {{- $pages := .Pages.ByParam "series_weight" -}} + {{- if eq $taxonomy "series" -}} + {{- $pages = .Pages.ByParam "series_weight" -}} + {{- with .Site.Params.list.paginate | default .Site.Params.paginate -}} + {{- $pages = $.Paginate $pages . -}} + {{- else -}} + {{- $pages = .Paginate $pages -}} + {{- end -}} + {{- else -}} + {{- $pages = .Pages.GroupByDate "2006" -}} + {{- with .Site.Params.list.paginate | default .Site.Params.paginate -}} + {{- $pages = $.Paginate $pages . -}} + {{- else -}} + {{- $pages = .Paginate $pages -}} + {{- end -}} + {{- end -}} + {{- .Scratch.Set "paginatorPager" $pages -}} +{{- end -}} diff --git a/themes/DoIt/layouts/partials/head/seo.html b/themes/DoIt/layouts/partials/head/seo.html index e3ad6603d..b00f5de99 100644 --- a/themes/DoIt/layouts/partials/head/seo.html +++ b/themes/DoIt/layouts/partials/head/seo.html @@ -1,5 +1,3 @@ -{{- $params := .Scratch.Get "params" -}} - {{- with .Site.Params.verification.google -}} {{- end -}} @@ -22,60 +20,13 @@ {{- end -}} -{{- /* Home SEO */ -}} -{{- if .IsHome -}} - - -{{- /* Page SEO */ -}} -{{- else if .IsPage -}} - + {{- end -}} + +{{- /* Page SEO */ -}} +{{- else if .IsPage -}} + {{- end -}} diff --git a/themes/DoIt/layouts/taxonomy/list.html b/themes/DoIt/layouts/taxonomy/list.html index cbd37d8c0..c5feacf0b 100644 --- a/themes/DoIt/layouts/taxonomy/list.html +++ b/themes/DoIt/layouts/taxonomy/list.html @@ -1,10 +1,14 @@ {{- define "title" -}} - {{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}} + {{- if (gt .Paginator.PageNumber 1) -}} + {{ $pageNumber := printf "%v %v %v" (T "prefixPageNumber" ) .Paginator.PageNumber (T "suffixPageNumber" ) }} + {{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} {{ $pageNumber }} - {{ .Site.Title -}} + {{- else -}} + {{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}} + {{- end -}} {{- end -}} {{- define "content" -}} {{- $params := .Scratch.Get "params" -}} -
{{- /* Title */ -}}

@@ -47,16 +51,11 @@

{{- end -}} {{- /* Paginate */ -}} + {{- /* Paginate is first call on baseof.html */ -}} {{- if .Pages -}} {{- $taxonomy := .Data.Singular -}} {{- if eq $taxonomy "series" -}} - {{- $pages := .Pages.ByParam "series_weight" -}} - {{- with .Site.Params.list.paginate | default .Site.Params.paginate -}} - {{- $pages = $.Paginate $pages . -}} - {{- else -}} - {{- $pages = .Paginate $pages -}} - {{- end -}} - {{- range $pages.Pages -}} + {{- range .Paginator.Pages -}} {{- end -}} {{- else -}} - {{- $pages := .Pages.GroupByDate "2006" -}} - {{- with .Site.Params.list.paginate | default .Site.Params.paginate -}} - {{- $pages = $.Paginate $pages . -}} - {{- else -}} - {{- $pages = .Paginate $pages -}} - {{- end -}} - {{- range $pages.PageGroups -}} + {{- range .Paginator.PageGroups -}}

{{ .Key }}

{{- range .Pages -}}