Merge pull request #181 from brainspark/default-description-for-taxonomy
Add a default Description for taxonomy pages
This commit is contained in:
commit
8014d6faa6
1 changed files with 22 additions and 3 deletions
|
|
@ -1,14 +1,33 @@
|
|||
{{- if eq .Kind "taxonomyTerm" }}
|
||||
{{- range $key, $value := .Data.Terms.ByCount }}
|
||||
{{- $.Scratch.Add "most_used" (slice $value.Name) }}
|
||||
{{- end }}
|
||||
{{- $description := printf "A full overview of all pages with %s, ordered by %s, such as: %s" .Data.Plural .Data.Singular ( delimit ( $.Scratch.Get "most_used" ) ", " ", and " ) | truncate 180 }}
|
||||
{{- $.Scratch.Set "Description" $description }}
|
||||
|
||||
{{- $title := printf "Overview of all pages with %s, ordered by %s" .Data.Plural .Data.Singular }}
|
||||
{{- $.Scratch.Set "Title" $title }}
|
||||
{{- else if eq .Kind "taxonomy" }}
|
||||
{{- $description := printf "Overview of all pages with the %s #%s, such as: %s" .Data.Singular $.Title ( index .Pages 0).Title | truncate 160 }}
|
||||
{{- $.Scratch.Set "Description" $description }}
|
||||
|
||||
{{- $title := printf "Overview of all pages with the %s #%s" .Data.Singular $.Title }}
|
||||
{{- $.Scratch.Set "Title" $title }}
|
||||
{{- else }}
|
||||
{{- $.Scratch.Set "Description" ( .Description | default .Params.subtitle | default .Summary ) }}
|
||||
{{- $.Scratch.Set "Title" ( .Title | default .Site.Title ) }}
|
||||
{{- end }}
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||
<!-- Site Title, Description, Author, and Favicon -->
|
||||
{{- with .Title | default .Site.Title }}
|
||||
<title>{{ . }}</title>
|
||||
{{- with ($.Scratch.Get "Title") }}
|
||||
<title>{{ . }} - {{ $.Site.Title }}</title>
|
||||
<meta property="og:title" content="{{ . }}" />
|
||||
<meta name="twitter:title" content="{{ . | truncate 70 }}" />
|
||||
{{- end }}
|
||||
{{- with .Description | default .Params.subtitle | default .Summary }}
|
||||
{{- with ($.Scratch.Get "Description") }}
|
||||
<meta name="description" content="{{ . }}">
|
||||
<meta property="og:description" content="{{ . }}">
|
||||
<meta name="twitter:description" content="{{ . | truncate 200 }}">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue