diff options
| author | Serghei Iakovlev <egrep@protonmail.ch> | 2022-05-02 00:20:51 +0200 |
|---|---|---|
| committer | Serghei Iakovlev <egrep@protonmail.ch> | 2022-05-02 00:20:51 +0200 |
| commit | bc6526e7b332138502daeeaefa1a835d6ab44b8a (patch) | |
| tree | 4a4f23c328b5ec707fa1a3aaf3951b974ed53d72 /layouts | |
| parent | 9d2623026c931ccacd03d0ee98ad52dda7960995 (diff) | |
| download | gohugo-theme-ed-bc6526e7b332138502daeeaefa1a835d6ab44b8a.tar.gz | |
Truncate description in meta tag
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/partials/templates/doublinecore.html | 2 | ||||
| -rw-r--r-- | layouts/partials/templates/opengraph.html | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/layouts/partials/templates/doublinecore.html b/layouts/partials/templates/doublinecore.html index 674d343..04e8ae6 100644 --- a/layouts/partials/templates/doublinecore.html +++ b/layouts/partials/templates/doublinecore.html @@ -11,4 +11,4 @@ <meta property="dc:source" content="{{ if .Params.source }}{{ .Params.source }}{{ else }}{{ site.Title }}{{ end }}"> {{- with .Params.date }} {{ printf "<meta property=\"dc:date\" content=\"%s\">" (.UTC.Format "2006-01-02T15:04:05-07:00") | safeHTML }} -{{- end }} +{{- end -}} diff --git a/layouts/partials/templates/opengraph.html b/layouts/partials/templates/opengraph.html index e3dad0f..c94fd68 100644 --- a/layouts/partials/templates/opengraph.html +++ b/layouts/partials/templates/opengraph.html @@ -1,6 +1,6 @@ <!-- Open Graph metadata --> <meta property="og:title" content="{{ .Title }}"> - <meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}"> + <meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ replaceRE "\n" " " (.Summary | truncate 170) }}{{ 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 }}"> {{- if .Params.cover.image -}} |
