From 1d25bd8028e81791709b85bc54fbe153776cf22c Mon Sep 17 00:00:00 2001 From: Fity Yang Date: Wed, 15 Jan 2020 01:00:10 +0800 Subject: set default layout for taxonomies --- layouts/_default/terms.html | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html index 058744d..110cd63 100644 --- a/layouts/_default/terms.html +++ b/layouts/_default/terms.html @@ -1,4 +1,4 @@ -{{ define "title" }}{{ i18n .Data.Plural }} - {{ .Site.Title }}{{ end }} +{{ define "title" }}{{ i18n .Data.Plural | default (title .Data.Plural ) }} - {{ .Site.Title }}{{ end }} {{ define "content" }} {{ $termName := .Data.Singular }} @@ -114,6 +114,40 @@ {{ end }} {{ end }} + {{ else }} + {{ range $terms }} + {{ $term := .Term }} + {{ $pages := .Pages }} + {{ with $.Site.GetPage "taxonomy" (printf "%s/%s" $type $term)}} +
+
+ + {{ range first 5 $pages }} +
+ + + + {{ .Title }} + + +
+ {{ end }} + {{ if gt (len $pages) 5 }} +
+ {{ i18n "morePost" }} +
+ {{ end }} +
+ {{ end }} + {{ end }} {{ end }} -- cgit v1.2.3