Browse Source

fix(layouts): output meta description when not explicitly set

description now outputs when not explicitly set and matches the logic used for outputting the open
graph description. if there's an explicit description, output that. if not, output the content
summary if it's a page. otherwise output the site description.

closes #21
Josh Habdas 3 years ago
parent
commit
21e86be101
1 changed files with 1 additions and 3 deletions
  1. 1
    3
      layouts/_default/baseof.html

+ 1
- 3
layouts/_default/baseof.html View File

@@ -5,9 +5,7 @@
5 5
     <meta charset="utf-8">
6 6
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 7
     <title>{{ block "title" . }}{{ .Title }} | {{ .Site.Title }}{{ end }}</title>
8
-    {{ with .Description }}
9
-      <meta name="description" content="{{ . }}">
10
-    {{ end }}
8
+    <meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage }}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
11 9
     {{ $default_noindex_kinds := slice "section" "taxonomy" "taxonomyTerm" }}
12 10
     {{ $noindex_kinds := .Site.Params.noindex_kinds | default $default_noindex_kinds }}
13 11
     {{ $is_noindex_true := and (isset .Params "noindex") .Params.noindex }}

Loading…
Cancel
Save