diff options
-rw-r--r-- | layouts/_default/baseof.html | 10 | ||||
-rw-r--r-- | layouts/partials/meta.html (renamed from layouts/partials/head.html) | 21 |
2 files changed, 21 insertions, 10 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index c959174..5282f44 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,7 +1,15 @@ <!DOCTYPE html> <html lang="{{ site.LanguageCode }}"> <head> - {{ partial "head.html" . }} + {{ partial "meta.html" . }} + <title> + {{ if eq .Title site.Title }} + {{ site.Title }} + {{ else }} + {{ with .Title }}{{ . }} | {{ end }}{{ site.Title }} + {{ end }} + </title> + <link rel="canonical" href="{{ .Permalink }}"> {{ range .AlternativeOutputFormats }} {{ printf "<link rel=%q type=%q href=%q title=%q>" .Rel .MediaType .Permalink site.Title | safeHTML }} {{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/meta.html index 24b71a7..696e244 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/meta.html @@ -1,14 +1,17 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> -{{ hugo.Generator }} +{{ with .Description }} +<meta name="description" content="{{ . }}"> +{{ else }} +{{ if .IsPage }} +<meta name="description" content="{{ .Summary }}"> +{{ else }} +{{ with .Site.Params.description }} +<meta name="description" content="{{ . }}"> +{{ end }} +{{ end }} +{{ end }} {{ if site.Params.schema }}{{ template "_internal/schema.html" . }}{{ end }} {{ if site.Params.opengraph }}{{ template "_internal/opengraph.html" . }}{{ end }} {{ if site.Params.twittercards }}{{ template "_internal/twitter_cards.html" . }}{{ end }} -<title> - {{ if eq .Title site.Title }} - {{ site.Title }} - {{ else }} - {{ with .Title }}{{ . }} | {{ end }}{{ site.Title }} - {{ end }} -</title> -<link rel="canonical" href="{{ .Permalink }}"> +{{ hugo.Generator }} |