Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xianmin/hugo-theme-jane.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFity Yang <imfity@gmail.com>2020-01-14 20:00:10 +0300
committerFity Yang <imfity@gmail.com>2020-01-14 20:00:10 +0300
commit1d25bd8028e81791709b85bc54fbe153776cf22c (patch)
tree90ad35cfc99ee1c27a66d658066110f773387586
parent1b73e49894e080e444fea1ccf3d5ba659db5cfb4 (diff)
set default layout for taxonomies
-rw-r--r--layouts/_default/terms.html36
1 files changed, 35 insertions, 1 deletions
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 @@
</section>
{{ end }}
{{ end }}
+ {{ else }}
+ {{ range $terms }}
+ {{ $term := .Term }}
+ {{ $pages := .Pages }}
+ {{ with $.Site.GetPage "taxonomy" (printf "%s/%s" $type $term)}}
+ <section id="archive" class="archive">
+ <div class="archive-title"></div>
+ <div class="collection-title">
+ <h2 class="archive-year">
+ <a href="{{ .Permalink }}">
+ {{ i18n $termName | default (printf "%s: " (title $termName)) }}{{ $term }}
+ </a>
+ </h2>
+ </div>
+ {{ range first 5 $pages }}
+ <div class="archive-post">
+ <time datetime="{{ .Date.Format "2006-01-02" }}" class="archive-post-time">
+ {{ .Date.Format "2006-01-02" }}
+ </time>
+ <span class="archive-post-title">
+ <a href="{{ .RelPermalink }}" class="archive-post-link">
+ {{ .Title }}
+ </a>
+ </span>
+ </div>
+ {{ end }}
+ {{ if gt (len $pages) 5 }}
+ <div class="more-post">
+ <a href="{{ .Permalink }}" class="more-post-link">{{ i18n "morePost" }}</a>
+ </div>
+ {{ end }}
+ </section>
+ {{ end }}
+ {{ end }}
{{ end }}