From a1a5e22cce5da1d3c2df63abc4c284a44dc065b5 Mon Sep 17 00:00:00 2001 From: Ngô Ngọc Đức Huy Date: Tue, 8 Jun 2021 22:11:32 +0700 Subject: Add layout for comics --- layouts/_default/single.html | 17 ++++++++++++++--- layouts/partials/comicNav.html | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 layouts/partials/comicNav.html diff --git a/layouts/_default/single.html b/layouts/_default/single.html index b3783eb..2c87ed3 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -12,10 +12,21 @@

{{ trim .Title " " }}

+ + {{ if in .Params.categories "comics" }} +
+ {{ partial "comicNav.html" . }} {{ .Content }} - {{ if in .Params.categories "book review" }} -
- {{ i18n "BookShare" }} + {{ partial "comicNav.html" . }} +
+ {{ else }} + + {{ .Content }} + + {{ if in .Params.categories "book review" }} +
+ {{ i18n "BookShare" }} + {{ end }} {{ end }}
{{ partial "postInfo.html" . }} diff --git a/layouts/partials/comicNav.html b/layouts/partials/comicNav.html new file mode 100644 index 0000000..2d8eeac --- /dev/null +++ b/layouts/partials/comicNav.html @@ -0,0 +1,40 @@ +{{ $comics := ($.Site.GetPage "section" .Section).Pages.ByPublishDate }} +{{ $random := (shuffle (where (where .Site.RegularPages "Section" "comics") "Title" "!=" .Title )) }} + +{{ if (eq .PrevInSection nil) }} + + +{{ end }} + +{{ with .PrevInSection }} + {{ range first 1 $comics }} + + + + {{ end }} + + + +{{ end }} + +{{ range first 1 $random }} + + + +{{ end }} + +{{ with .NextInSection }} + + + + + {{ range last 1 $comics }} + + + + {{ end }} +{{ end }} +{{ if (eq .NextInSection nil) }} + + +{{ end }} -- cgit 1.4.1