Skip to content

Commit

Permalink
Add a default Description for taxonomy pages
Browse files Browse the repository at this point in the history
Make use of the detection of the .Kind of page to have a default
description for SEO purposes
  • Loading branch information
pjbakker committed Jun 28, 2018
1 parent e78f3c8 commit 7b11f7f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
<meta property="og:title" content="{{ . }}" />
<meta name="twitter:title" content="{{ . | truncate 70 }}" />
{{- end }}
{{- with .Description | default .Params.subtitle | default .Summary }}
{{- if eq .Kind "taxonomyTerm" }}
{{- $text := printf "Overview of all pages by %s" .Data.Singular }}
{{- $.Scratch.Set "Description" $text }}
{{- else if eq .Kind "taxonomy" }}
{{- $text := printf "Overview of all pages with the %s #%s" .Data.Singular $.Title }}
{{- $.Scratch.Set "Description" $text }}
{{- end }}
{{- with .Description | default .Params.subtitle | default .Summary | default ($.Scratch.Get "Description") }}
<meta name="description" content="{{ . }}">
<meta property="og:description" content="{{ . }}">
<meta name="twitter:description" content="{{ . | truncate 200 }}">
Expand Down

0 comments on commit 7b11f7f

Please sign in to comment.