diff options
| author | Reorx <novoreorx@gmail.com> | 2022-05-05 18:47:00 +0800 |
|---|---|---|
| committer | Reorx <novoreorx@gmail.com> | 2022-05-05 18:47:00 +0800 |
| commit | 4f722e0c6d05755ee47ca748b03ae6bbd2f7ccf6 (patch) | |
| tree | dd95605dad5e173daaea543ff55ac31a2f4345d8 /layouts/partials/head.html | |
| parent | e1216a8d0052f8c135beb3493dea2c91903bbc17 (diff) | |
add site title after title
Diffstat (limited to 'layouts/partials/head.html')
| -rw-r--r-- | layouts/partials/head.html | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html index d855306..43ef99e 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -8,7 +8,11 @@ {{- end }} {{- /* Title */}} -<title>{{ if .IsHome }}{{ else }}{{ if .Title }}{{ .Title }} | {{ end }}{{ end }}{{ site.Title }}</title> +{{- $pageTitle := site.Title }} +{{- if (and .Title (not .IsHome)) }} + {{- $pageTitle = printf "%s | %s" .Title $pageTitle }} +{{- end }} +<title>{{ $pageTitle }}</title> {{- /* Meta */}} {{- if .IsHome }} @@ -73,19 +77,17 @@ {{- /* https://developer.twitter.com/en/docs/twitter-for-websites/cards/guides/getting-started */}} {{- if .Params.cover.image }} - <meta name="twitter:card" property="twitter:card" content="summary_large_image" /> <meta name="twitter:image" content="{{ (path.Join .RelPermalink .Params.cover.image ) | absURL }}" /> - <meta name="twitter:title" content="{{ .Title }}" /> - <meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}" /> - <meta name="twitter:site" content="@novoreorx" /> - <meta name="twitter:creator" content="@novoreorx" /> -{{- else -}} - {{- template "_internal/twitter_cards.html" . -}} {{- end -}} +<meta name="twitter:card" property="twitter:card" content="summary_large_image" /> +<meta name="twitter:title" content="{{ $pageTitle }}" /> +<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}" /> +<meta name="twitter:site" content="@novoreorx" /> +<meta name="twitter:creator" content="@novoreorx" /> -{{- template "partials/templates/opengraph.html" . }} +{{- template "partials/templates/opengraph.html" (dict "page" . "pageTitle" $pageTitle) }} -{{- template "partials/templates/schema_json.html" . }} +{{- template "partials/templates/schema_json.html" (dict "page" . "pageTitle" $pageTitle) }} {{- partial "extend_head.html" . }} <noscript> |
