diff options
| -rw-r--r-- | layouts/partials/head.html | 22 | ||||
| -rw-r--r-- | layouts/partials/templates/opengraph.html | 5 | ||||
| -rw-r--r-- | layouts/partials/templates/schema_json.html | 5 |
3 files changed, 19 insertions, 13 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> diff --git a/layouts/partials/templates/opengraph.html b/layouts/partials/templates/opengraph.html index 6b187f2..4a1de00 100644 --- a/layouts/partials/templates/opengraph.html +++ b/layouts/partials/templates/opengraph.html @@ -1,4 +1,5 @@ -<meta property="og:title" content="{{ .Title }}" /> +{{ with .page }} +<meta property="og:title" content="{{ $.pageTitle }}" /> <meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" /> <meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" /> <meta property="og:url" content="{{ .Permalink }}" /> @@ -50,3 +51,5 @@ {{- /* Facebook Page Admin ID for Domain Insights */}} {{- with site.Social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }} + +{{- end }} diff --git a/layouts/partials/templates/schema_json.html b/layouts/partials/templates/schema_json.html index 6ce1c2e..8831609 100644 --- a/layouts/partials/templates/schema_json.html +++ b/layouts/partials/templates/schema_json.html @@ -1,3 +1,4 @@ +{{ with .page }} {{ if .IsHome }} <script type="application/ld+json"> { @@ -60,7 +61,7 @@ { "@context": "https://schema.org", "@type": "BlogPosting", - "headline": {{ .Title | plainify}}, + "headline": {{ $.pageTitle | plainify}}, "name": "{{ .Title | plainify }}", "description": {{ with .Description | plainify }}{{ . }}{{ else }}{{ .Summary | plainify }}{{ end -}}, "keywords": [ @@ -70,7 +71,6 @@ {{ range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }} {{- end }} ], - "articleBody": {{ .Content | safeJS | htmlUnescape | plainify }}, "wordCount" : "{{ .WordCount }}", "inLanguage": {{ .Language.Lang | default "en-us" }}, {{ if .Params.cover.image -}} @@ -117,3 +117,4 @@ {{- end }}{{/* .IsPage end */}} {{- end -}} +{{- end -}} |
