From d6290dcf509c84a38df667813ad3acdcf58c09f5 Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Thu, 19 Dec 2019 17:22:12 +0100 Subject: #66, add taxonomy support --- layouts/partials/docs/post-meta.html | 18 ++++++++++++++++++ layouts/partials/docs/taxonomy.html | 20 ++++++++++++++++++++ layouts/posts/list.html | 10 +++------- layouts/posts/single.html | 19 ++++++++----------- layouts/taxonomy/list.html | 13 +++++++++++++ layouts/taxonomy/taxonomy.html | 22 ++++++++++++++++++++++ 6 files changed, 84 insertions(+), 18 deletions(-) create mode 100644 layouts/partials/docs/post-meta.html create mode 100644 layouts/partials/docs/taxonomy.html (limited to 'layouts') 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 }} +
+{{ with .Date}} +
{{ .Format $dateFormat }}
+{{ end }} + +{{ range $term, $_ := .Site.Taxonomies }} + {{ with $list := index $.Params $term }} + {{ range $n, $single := $list }}{{ if $n }}, {{ end -}} + {{ $single }} + {{- end }} +
+ {{ end }} +{{ end }} + +
+{{ 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 @@ + 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 }}

{{ .Title }}

- {{ with .Date }} -
- {{ .Format $dateFormat }} -
- {{ end }} + {{ partial "docs/post-meta" . }}

{{- .Summary -}} {{ if .Truncated }} @@ -19,9 +14,10 @@

{{ 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 }} -
-

{{ .Title }}

- {{ with .Date }} -
- {{ .Format $dateFormat }} -
- {{ end }} -
-
+
+

+ {{ .Title }} +

+ {{ partial "docs/post-meta" . }} +

{{- .Content -}} -

+

+
{{ 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" }} +
+

{{ .Title | title }}

+ {{ $taxonomies := index .Site.Taxonomies .Page.Type }} + {{ range $taxonomies }} +
{{ .Page.Title }} {{ .Count }}
+ {{ end }} +
+{{ 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 }} +
+

+ {{ .Title }} +

+ {{ partial "docs/post-meta" . }} +

+ {{- .Summary -}} + {{ if .Truncated }} + ... + {{ end }} +

+
+ {{ end }} + {{ template "_internal/pagination.html" . }} +{{ end }} + +{{ define "toc" }} + {{ partial "docs/taxonomy" . }} +{{ end }} -- cgit v1.2.3