Skip to content
Permalink
Browse files

Merge pull request #277 from Fity/fix-taxonomies

set default layout for taxonomies
  • Loading branch information
xianmin committed Feb 6, 2020
2 parents 1b73e49 + 1d25bd8 commit 7fa1a5f1f12727dbb87a91b40ba5abe66a8e0022
Showing with 35 additions and 1 deletion.
  1. +35 −1 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 @@ <h2 class="archive-year">
</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 }}

0 comments on commit 7fa1a5f

Please sign in to comment.
You can’t perform that action at this time.