diff options
author | Alex Shpak <alex-shpak@users.noreply.github.com> | 2019-12-19 17:22:12 +0100 |
---|---|---|
committer | Alex Shpak <alex-shpak@users.noreply.github.com> | 2019-12-19 17:22:12 +0100 |
commit | d6290dcf509c84a38df667813ad3acdcf58c09f5 (patch) | |
tree | 8cc7c6134148e24df3c12589b7faa12cadf4fb71 /layouts | |
parent | f5a52e6ed124526ebd070480068e6e145af11d9a (diff) |
#66, add taxonomy support
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/partials/docs/post-meta.html | 18 | ||||
-rw-r--r-- | layouts/partials/docs/taxonomy.html | 20 | ||||
-rw-r--r-- | layouts/posts/list.html | 10 | ||||
-rw-r--r-- | layouts/posts/single.html | 19 | ||||
-rw-r--r-- | layouts/taxonomy/list.html | 13 | ||||
-rw-r--r-- | layouts/taxonomy/taxonomy.html | 22 |
6 files changed, 84 insertions, 18 deletions
diff --git a/layouts/partials/docs/post-meta.html b/layouts/partials/docs/post-meta.html new file mode 100644 index 0000000..37b6080 --- /dev/null +++ b/layouts/partials/docs/post-meta.html @@ -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 }} diff --git a/layouts/partials/docs/taxonomy.html b/layouts/partials/docs/taxonomy.html new file mode 100644 index 0000000..f2c00d5 --- /dev/null +++ b/layouts/partials/docs/taxonomy.html @@ -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> diff --git a/layouts/posts/list.html b/layouts/posts/list.html index 3a3eb97..6115fae 100644 --- a/layouts/posts/list.html +++ b/layouts/posts/list.html @@ -1,16 +1,11 @@ {{ define "main" }} - {{ $dateFormat := default "January 2, 2006" .Site.Params.BookDateFormat }} {{ $paginator := .Paginate (where .Pages "Params.hidden" "ne" true) }} {{ range sort .Paginator.Pages }} <article class="markdown book-post"> <h2> <a href="{{ .RelPermalink }}">{{ .Title }}</a> </h2> - {{ with .Date }} - <h5> - <strong>{{ .Format $dateFormat }}</strong> - </h5> - {{ end }} + {{ partial "docs/post-meta" . }} <p> {{- .Summary -}} {{ if .Truncated }} @@ -19,9 +14,10 @@ </p> </article> {{ end }} + {{ template "_internal/pagination.html" . }} {{ end }} {{ define "toc" }} - + {{ partial "docs/taxonomy" . }} {{ end }} diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 69352cd..00df697 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -1,16 +1,13 @@ {{ define "main" }} - {{ $dateFormat := default "January 2, 2006" .Site.Params.BookDateFormat }} - <header class="markdown"> - <h1>{{ .Title }}</h1> - {{ with .Date }} - <h5> - <strong>{{ .Format $dateFormat }}</strong> - </h5> - {{ end }} - </header> - <article class="markdown"> +<article class="markdown"> + <h1> + <a href="{{ .RelPermalink }}">{{ .Title }}</a> + </h1> + {{ partial "docs/post-meta" . }} + <p> {{- .Content -}} - </article> + </p> +</article> {{ end }} {{ define "toc" }} diff --git a/layouts/taxonomy/list.html b/layouts/taxonomy/list.html index e69de29..31ecd90 100644 --- a/layouts/taxonomy/list.html +++ b/layouts/taxonomy/list.html @@ -0,0 +1,13 @@ +{{ define "main" }} +<article class="markdown"> + <h1>{{ .Title | title }}</h1> + {{ $taxonomies := index .Site.Taxonomies .Page.Type }} + {{ range $taxonomies }} + <div><a href="{{ .Page.Permalink }}">{{ .Page.Title }} <sup>{{ .Count }}</sup></a></div> + {{ end }} +</article> +{{ end }} + +{{ define "toc" }} + {{ partial "docs/taxonomy" . }} +{{ end }} diff --git a/layouts/taxonomy/taxonomy.html b/layouts/taxonomy/taxonomy.html index e69de29..91a7458 100644 --- a/layouts/taxonomy/taxonomy.html +++ b/layouts/taxonomy/taxonomy.html @@ -0,0 +1,22 @@ +{{ define "main" }} + {{ $paginator := .Paginate (where .Pages "Params.hidden" "ne" true) }} + {{ range sort .Paginator.Pages }} + <article class="markdown book-post"> + <h2> + <a href="{{ .RelPermalink }}">{{ .Title }}</a> + </h2> + {{ partial "docs/post-meta" . }} + <p> + {{- .Summary -}} + {{ if .Truncated }} + <a href="{{ .RelPermalink }}">...</a> + {{ end }} + </p> + </article> + {{ end }} + {{ template "_internal/pagination.html" . }} +{{ end }} + +{{ define "toc" }} + {{ partial "docs/taxonomy" . }} +{{ end }} |