From ce8f1a90e91cd79518d68cf17dff647f29c866af Mon Sep 17 00:00:00 2001 From: Olivia206 <olivia.simonet@mmibordeaux.com> Date: Mon, 24 Apr 2023 16:43:25 +0200 Subject: [PATCH] fix #102 --- i18n/en.yml | 1 + i18n/fr.yml | 1 + layouts/partials/GetPaginateTitle | 14 ++++++++++++++ layouts/partials/head/seo.html | 1 + 4 files changed, 17 insertions(+) create mode 100644 layouts/partials/GetPaginateTitle diff --git a/i18n/en.yml b/i18n/en.yml index f2b298f3..56550f95 100644 --- a/i18n/en.yml +++ b/i18n/en.yml @@ -101,6 +101,7 @@ commons: between: pages: Pages navigation posts: Posts navigation + title: Page pdf: PDF pdf_with_size: PDF ({{ .Size }}) read: Read diff --git a/i18n/fr.yml b/i18n/fr.yml index a2e5e2d7..80833e3d 100644 --- a/i18n/fr.yml +++ b/i18n/fr.yml @@ -101,6 +101,7 @@ commons: between: pages: Navigation entre pages posts: Navigation entre articles + title: Page pdf: PDF pdf_with_size: PDF ({{ .Size }}) read: Lire diff --git a/layouts/partials/GetPaginateTitle b/layouts/partials/GetPaginateTitle new file mode 100644 index 00000000..abcc7c46 --- /dev/null +++ b/layouts/partials/GetPaginateTitle @@ -0,0 +1,14 @@ +{{ $seoTitle := .title }} +{{ $seoTitleSeparator := .separator}} +{{ $page := i18n "commons.pagination.title" }} + +{{if not .context.IsHome }} + {{ with .context.Paginator }} + {{ if or .HasPrev .HasNext }} + {{ $currentPageNumber := .PageNumber}} + {{ $seoTitle = printf "%s %s %s %d" $seoTitle $seoTitleSeparator $page $currentPageNumber }} + {{ end }} + {{ end }} +{{ end }} + +{{ return $seoTitle }} \ No newline at end of file diff --git a/layouts/partials/head/seo.html b/layouts/partials/head/seo.html index 25a18d98..138b9262 100644 --- a/layouts/partials/head/seo.html +++ b/layouts/partials/head/seo.html @@ -4,6 +4,7 @@ {{- if .Title -}} {{- $seoTitle = printf "%s %s %s" $title $seoTitleSeparator $seoTitle -}} {{- end -}} +{{- $seoTitle = partial "GetPaginateTitle" ( dict "title" $seoTitle "separator" $seoTitleSeparator "context" .) -}} {{- $seoDescription := "" -}} {{- if .Params.meta_description -}} {{- $seoDescription = partial "PrepareHTML" .Params.meta_description -}} -- GitLab