Skip to content
Snippets Groups Projects
Unverified Commit 576374b1 authored by Alexis BENOIT's avatar Alexis BENOIT Committed by GitHub
Browse files

Gestion du titre de la page (#808)

parent 7aea1de2
No related branches found
Tags v7.2.6
No related merge requests found
......@@ -11,7 +11,6 @@ params:
plausible: false
seo:
title:
sitename: true
separator: "|"
# DESIGN SYSTEM
......@@ -39,6 +38,8 @@ params:
position: primary # primary | upper-menu | fixed | footer
appearance: icon # icon | text | both
home:
head:
title: both # both | page | site
toc:
disabled: true
toc:
......
{{ $pageTitle := chomp (htmlUnescape .Title) }}
{{ $siteTitle := htmlUnescape site.Title }}
{{ $separator := htmlUnescape site.Params.seo.title.separator }}
{{ $title := printf "%s %s %s" $pageTitle $separator $siteTitle }}
{{/* PAGE OPTION */}}
{{ $option := "both" }}
{{ if .IsHome }}
{{ $option = site.Params.home.head.title }}
{{ end }}
{{ if eq $option "page" }}
{{ $title = $pageTitle }}
{{ else if eq $option "site" }}
{{ $title = $siteTitle }}
{{ end }}
{{/* PAGINATION */}}
{{ if and (not .IsHome) (eq .Kind "section") }}
{{ with .Paginator }}
{{ if or .HasPrev .HasNext }}
{{ $page_label := i18n "commons.pagination.title" }}
{{ $currentPageNumber := .PageNumber }}
{{ $title = printf "%s %s %s %d" $title $separator $page_label $currentPageNumber }}
{{ end }}
{{ end }}
{{ end }}
{{ return $title }}
\ No newline at end of file
{{ $seoTitle := .title }}
{{ $seoTitleSeparator := .separator }}
{{ $page := i18n "commons.pagination.title" }}
{{ if and (not .context.IsHome) (eq .context.Kind "section") }}
{{ 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
{{- $title := chomp (htmlUnescape .Title) -}}
{{- $seoTitle := htmlUnescape site.Title -}}
{{- $seoTitleSeparator := htmlUnescape site.Params.seo.title.separator -}}
{{- if $title -}}
{{- if site.Params.seo.title.sitename }}
{{- $seoTitle = printf "%s %s %s" $title $seoTitleSeparator $seoTitle -}}
{{ else -}}
{{- $seoTitle = $title -}}
{{ end -}}
{{- end -}}
{{- $seoTitle = partial "GetPaginateTitle" ( dict "title" $seoTitle "separator" $seoTitleSeparator "context" . ) -}}
{{- $title := partial "GetHeadTitle" . -}}
{{- $seoDescription := "" -}}
{{- if .Params.meta_description -}}
{{- $seoDescription = partial "PrepareHTML" .Params.meta_description -}}
......@@ -52,11 +43,11 @@
{{- $seoUrl := .Permalink -}}
<!-- HTML Meta Tags -->
<title>{{ $seoTitle }}</title>
<title>{{ $title }}</title>
<meta name="description" content="{{ $seoDescription }}">
<!-- Facebook Meta Tags -->
<meta property="og:title" content="{{ $seoTitle }}">
<meta property="og:title" content="{{ $title }}">
<meta property="og:description" content="{{ $seoDescription }}">
{{- with $ogImage }}
<meta property="og:image" content="{{ . }}">
......@@ -65,7 +56,7 @@
<meta property="og:type" content="website">
<!-- Twitter Meta Tags -->
<meta name="twitter:title" content="{{ $seoTitle }}">
<meta name="twitter:title" content="{{ $title }}">
<meta name="twitter:description" content="{{ $seoDescription }}">
{{- with $twitterImage }}
<meta name="twitter:image" content="{{ . }}">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment