reafctor(head): rewrite description.html function
This commit is contained in:
parent
6f5ee1bbdb
commit
5265af0b3b
@ -1,11 +1,12 @@
|
|||||||
{{- with .Description -}}
|
<!-- Use site subtitle by default -->
|
||||||
{{- . -}}
|
{{ $description := .Site.Params.subtitle }}
|
||||||
{{- else -}}
|
|
||||||
{{- if .IsPage -}}
|
{{ if .Description }}
|
||||||
{{- .Summary -}}
|
<!-- Page description exists -->
|
||||||
{{- else -}}
|
{{ $description = .Description }}
|
||||||
{{- with .Site.Params.subtitle -}}
|
{{ else if .IsPage }}
|
||||||
{{- . -}}
|
<!-- Use page summary -->
|
||||||
{{- end -}}
|
{{ $description = .Summary }}
|
||||||
{{- end -}}
|
{{ end }}
|
||||||
{{- end -}}
|
|
||||||
|
{{ return ($description | plainify)}}
|
@ -1,10 +1,13 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset='utf-8'>
|
<meta charset='utf-8'>
|
||||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||||
<meta name='description' content='{{ chomp (partial "data/description" . | plainify ) }}'>
|
|
||||||
|
{{- $description := partial "data/description" . -}}
|
||||||
|
<meta name='description' content='{{ $description }}'>
|
||||||
|
|
||||||
{{- $title := partial "data/title" . -}}
|
{{- $title := partial "data/title" . -}}
|
||||||
<title>{{ $title }}</title>
|
<title>{{ $title }}</title>
|
||||||
|
|
||||||
<link rel='canonical' href='{{ .Permalink }}'>
|
<link rel='canonical' href='{{ .Permalink }}'>
|
||||||
|
|
||||||
{{- partial "head/style.html" . -}}
|
{{- partial "head/style.html" . -}}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<meta property='og:title' content='{{ partial "data/title" . }}'>
|
{{- $title := partial "data/title" . -}}
|
||||||
<meta property='og:description' content='{{ chomp (partial "data/description" . | plainify ) }}'>
|
{{- $description := partial "data/description" . -}}
|
||||||
|
|
||||||
|
<meta property='og:title' content='{{ $title }}'>
|
||||||
|
<meta property='og:description' content='{{ $description }}'>
|
||||||
<meta property='og:url' content='{{ .Permalink }}'>
|
<meta property='og:url' content='{{ .Permalink }}'>
|
||||||
<meta property='og:site_name' content='{{ .Site.Title }}'>
|
<meta property='og:site_name' content='{{ .Site.Title }}'>
|
||||||
<meta property='og:type' content='
|
<meta property='og:type' content='
|
||||||
|
@ -2,8 +2,11 @@
|
|||||||
<meta name="twitter:site" content="{{ . }}">
|
<meta name="twitter:site" content="{{ . }}">
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
<meta name="twitter:title" content="{{ partial "data/title" . }}">
|
{{- $title := partial "data/title" . -}}
|
||||||
<meta name="twitter:description" content="{{ chomp (partial "data/description" . | plainify ) }}">
|
{{- $description := partial "data/description" . -}}
|
||||||
|
|
||||||
|
<meta name="twitter:title" content="{{ $title }}">
|
||||||
|
<meta name="twitter:description" content="{{ $description }}">
|
||||||
|
|
||||||
{{- $image := partial "helper/image" (dict "Context" . "Type" "opengraph") -}}
|
{{- $image := partial "helper/image" (dict "Context" . "Type" "opengraph") -}}
|
||||||
{{- if $image.exists -}}
|
{{- if $image.exists -}}
|
||||||
|
Loading…
Reference in New Issue
Block a user