Truncate description in meta tags to 170 charecters if it is taken from .Summary.
This commit is contained in:
parent
3cae5ce015
commit
fa9f59c76a
2 changed files with 2 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{{ range .AlternativeOutputFormats -}}
|
||||
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" title="{{ .Name }}" href="{{ .Permalink | safeURL }}">
|
||||
{{ end -}}
|
||||
<meta name="description" content="{{ if .IsPage }}{{ .Description | default (replaceRE "\n" " " .Summary) }}{{ else }}{{ $.Param "description" }}{{ end }}">
|
||||
<meta name="description" content="{{ with (.Description | default (replaceRE "\n" " " (.Summary | truncate 170))) }}{{ . }}{{ end }}">
|
||||
<meta name="created" content="{{ .Date.Format "2006-01-02T15:04:05-0700" }}">
|
||||
<meta name="modified" content="{{ .Lastmod.Format "2006-01-02T15:04:05-0700" }}">
|
||||
{{ with $.Param "author" }}<meta name="author" content="{{ . }}">{{ end }}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
"datePublished": {{ .Date.Format "2006-01-02T15:04:05Z07:00" }},
|
||||
"dateModified": {{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }},
|
||||
"url" : {{ .Permalink }},
|
||||
"description": {{ with (.Description | default (replaceRE "\n" " " .Summary)) }}{{ . }}{{ end }},
|
||||
"description": {{ with (.Description | default (replaceRE "\n" " " (.Summary | truncate 170))) }}{{ . }}{{ end }},
|
||||
{{ with .Params.tags -}}
|
||||
"keywords": {{ . }},
|
||||
{{ end -}}
|
||||
|
|
|
|||
Loading…
Reference in a new issue