From 64b71057a6c3e81dd319ef19a60cd976e92caeae Mon Sep 17 00:00:00 2001 From: Gardient Date: Sun, 18 Feb 2018 16:24:25 +0200 Subject: [PATCH] post section and taxonomy --- README.md | 4 ++-- layouts/partials/post-meta.html | 14 +++++++------- layouts/partials/prev-next-post.html | 14 ++++++++++++++ layouts/post/list.html | 14 ++++++++++++++ layouts/post/single.html | 17 +++++++++++++++++ layouts/taxonomy/list.html | 13 +++++++++++++ layouts/taxonomy/terms.html | 16 ++++++++++++++++ 7 files changed, 83 insertions(+), 9 deletions(-) create mode 100644 layouts/partials/prev-next-post.html create mode 100644 layouts/post/list.html create mode 100644 layouts/post/single.html create mode 100644 layouts/taxonomy/list.html create mode 100644 layouts/taxonomy/terms.html diff --git a/README.md b/README.md index c1f0541..1b66ff3 100644 --- a/README.md +++ b/README.md @@ -44,5 +44,5 @@ custom_css = [] - [x] Set up homepage template - [x] Post summry template - [ ] Complete readme -- [ ] Add list page template to post section -- [ ] Add taxonomy templates +- [x] Add list page template to post section +- [x] Add taxonomy templates diff --git a/layouts/partials/post-meta.html b/layouts/partials/post-meta.html index 3fa88cc..4984ece 100644 --- a/layouts/partials/post-meta.html +++ b/layouts/partials/post-meta.html @@ -6,21 +6,21 @@ {{ $baseUrl := .Site.BaseURL }} - {{ if isset .Params "topics" }} - {{ $count := len .Params.topics }} - {{ if gt $count 0 }} + {{ if isset .Params "categories" }} + {{ $count := len .Params.categories }} + {{ if gt $count 0 }}
- {{ range $k, $v := .Params.topics }} - {{ . }}{{ if lt $k (sub $count 1) }} /{{ end }} + {{ range $k, $v := .Params.categories }} + {{ . }}{{ if lt $k (sub $count 1) }} /{{ end }} {{ end }}
{{ end }} {{ end }} {{ if isset .Params "tags" }} - {{ $count := len .Params.tags }} - {{ if gt $count 0 }} + {{ $count := len .Params.tags }} + {{ if gt $count 0 }}
{{ range $k, $v := .Params.tags }} diff --git a/layouts/partials/prev-next-post.html b/layouts/partials/prev-next-post.html new file mode 100644 index 0000000..fbff68f --- /dev/null +++ b/layouts/partials/prev-next-post.html @@ -0,0 +1,14 @@ +{{ if or (.PrevInSection) (.NextInSection) }} +
+
+ {{ if .PrevInSection }} + {{ .PrevInSection.Title }} + {{ end }} +
+
+ {{ if .NextInSection }} + {{ .NextInSection.Title }} + {{ end }} +
+
+{{ end }} diff --git a/layouts/post/list.html b/layouts/post/list.html new file mode 100644 index 0000000..1d747e9 --- /dev/null +++ b/layouts/post/list.html @@ -0,0 +1,14 @@ +{{ define "main" }} +
+

{{ .Title }}

+

{{ .Site.Params.subtitle }}

+
+
+ {{ $paginator := .Paginate ( where .Data.Pages "Type" "post") }} + {{ range $paginator.Pages }} + {{ .Render "summary" }} + {{ end }} + + {{ partial "pagination.html" . }} +
+{{ end }} diff --git a/layouts/post/single.html b/layouts/post/single.html new file mode 100644 index 0000000..eed4c2b --- /dev/null +++ b/layouts/post/single.html @@ -0,0 +1,17 @@ +{{ define "main" }} +
+

{{ .Title }}

+

{{ .Description }}

+
+
+ + {{ partial "post-meta.html" . }} + + {{ .Content }} + + {{ partial "prev-next-post.html" . }} + + {{ partial "disqus.html" . }} + +
+{{ end }} diff --git a/layouts/taxonomy/list.html b/layouts/taxonomy/list.html new file mode 100644 index 0000000..ff86c22 --- /dev/null +++ b/layouts/taxonomy/list.html @@ -0,0 +1,13 @@ +{{ define "main" }} +
+

{{ .Title }}

+
+
+ {{ $paginator := .Paginate ( where .Data.Pages "Type" "post") }} + {{ range $paginator.Pages }} + {{ .Render "summary" }} + {{ end }} + + {{ partial "pagination.html" . }} +
+{{ end }} diff --git a/layouts/taxonomy/terms.html b/layouts/taxonomy/terms.html new file mode 100644 index 0000000..ecfd667 --- /dev/null +++ b/layouts/taxonomy/terms.html @@ -0,0 +1,16 @@ +{{ define "main" }} +
+

{{ .Title }}

+
+
+
    + {{ $data := .Data }} + {{ range $key, $value := .Data.Terms.ByCount }} +
  • + {{ $value.Name }} + ({{ $value.Count }}) +
  • + {{ end }} +
+
+{{ end }}