#66, add taxonomy support

This commit is contained in:
Alex Shpak
2019-12-19 17:22:12 +01:00
parent f5a52e6ed1
commit d6290dcf50
11 changed files with 87 additions and 24 deletions
+18
View File
@@ -0,0 +1,18 @@
{{ $dateFormat := default "January 2, 2006" .Site.Params.BookDateFormat }}
{{ if or .Date .Params.tags }}
<div>
{{ with .Date}}
<h5>{{ .Format $dateFormat }}</h5>
{{ end }}
{{ range $term, $_ := .Site.Taxonomies }}
{{ with $list := index $.Params $term }}
{{ range $n, $single := $list }}{{ if $n }}, {{ end -}}
<a href="/{{$term}}/{{$single}}/">{{ $single }}</a>
{{- end }}
<br />
{{ end }}
{{ end }}
</div>
{{ end }}
+20
View File
@@ -0,0 +1,20 @@
<aside class="book-toc fixed">
<nav>
<ul>
{{ range $term, $_ := .Site.Taxonomies }}
{{ with $.Site.GetPage (printf "/%s" $term) }}
<li class="book-section-flat">
<strong>{{ .Title | title }}</strong>
<ul>
{{ range .Pages }}
<li>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</li>
{{ end }}
</ul>
</li>
{{ end }}
{{ end }}
</ul>
</nav>
</aside>