Improve description meta tag.
This commit is contained in:
parent
dc69feb0d5
commit
1994fe787a
2 changed files with 10 additions and 4 deletions
|
|
@ -13,11 +13,13 @@
|
|||
"datePublished": {{ .Date.Format "2006-01-02T15:04:05Z07:00" }},
|
||||
"dateModified": {{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }},
|
||||
"url" : {{ .Permalink }},
|
||||
{{ with (.Description | default (replaceRE "\n" " " (.Plain | truncate 170))) -}}
|
||||
"description": {{ . }},
|
||||
{{ if .IsHome -}}
|
||||
{{ with $.Param "description" }}"description": {{ . }},{{ end }}
|
||||
{{ else -}}
|
||||
{{ with .Description }}"description": {{ . }},{{ end }}
|
||||
{{ end -}}
|
||||
{{ with .Params.tags -}}
|
||||
"keywords": {{ . }},
|
||||
"keywords": {{ delimit . " " }},
|
||||
{{ end -}}
|
||||
{{ else -}}
|
||||
"@type": "WebPage",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,11 @@
|
|||
<link rel="{{ .Rel }}" {{ printf "type=%q" .MediaType.Type | safeHTMLAttr }} title="{{ .Name }}" href="{{ .Permalink | safeURL }}">
|
||||
{{ end -}}
|
||||
<meta name="view-transition" content="same-origin">
|
||||
<meta name="description" content="{{ with (.Description | default (replaceRE "\n" " " (.Plain | truncate 170))) }}{{ . }}{{ end }}">
|
||||
{{ if .IsHome -}}
|
||||
{{ with $.Param "description" }}<meta name="description" content="{{ . }}">{{ end }}
|
||||
{{ else -}}
|
||||
{{ with .Description }}<meta name="description" content="{{ . }}">{{ end }}
|
||||
{{ end -}}
|
||||
<meta name="created" {{ printf "content=%q" (.Date.Format "2006-01-02T15:04:05-0700") | safeHTMLAttr }}>
|
||||
<meta name="modified" {{ printf "content=%q" (.Lastmod.Format "2006-01-02T15:04:05-0700") | safeHTMLAttr }}>
|
||||
{{ with .Params.author | default site.Params.author.name }}<meta name="author" content="{{ . }}">{{ end }}
|
||||
|
|
|
|||
Loading…
Reference in a new issue