From 9ea510e1068431fec024716bfb4b3f848840683c Mon Sep 17 00:00:00 2001 From: David Thurstenson Date: Thu, 7 Oct 2021 01:10:23 -0500 Subject: [PATCH] layouts: Migrate layout modifications from tlwiki Previous home: https://git.thurstylark.com/thurstylark/tlwiki/src/branch/master/layouts --- layouts/_default/list.html | 12 ++---------- layouts/_default/single.html | 9 --------- layouts/index.html | 3 ++- layouts/partials/asside.html | 9 +++++++++ layouts/partials/footer.html | 1 - layouts/partials/postlist.html | 13 +++++++++++++ layouts/partials/sectionlist.html | 13 +++++++++++++ layouts/partials/title_and_content.html | 4 ++++ layouts/partials/title_and_desc.html | 4 ++++ 9 files changed, 47 insertions(+), 21 deletions(-) create mode 100644 layouts/partials/asside.html create mode 100644 layouts/partials/postlist.html create mode 100644 layouts/partials/sectionlist.html create mode 100644 layouts/partials/title_and_content.html create mode 100644 layouts/partials/title_and_desc.html diff --git a/layouts/_default/list.html b/layouts/_default/list.html index f91cdb0..d113c49 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,12 +1,4 @@ {{ define "main" }} -

{{ .Title | markdownify }}

- - {{ .Content }} - - - + {{ partial "title_and_desc.html" . }} + {{ partial "postlist.html" . }} {{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 4dc326a..0ba14d8 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -8,12 +8,3 @@ {{ end }} -{{define "aside" }} - {{ if .Params.description }}

{{ .Params.description }}

{{ end }} - {{ if or (.Params.author) (.Params.date) }} -

- {{ if .Params.author }}By {{ .Params.author }}{{ if .Date }}, {{ end }}{{ end }} - {{ if .Date }}{{ .Date.Format "2006-01-02" }}{{ end }} -

- {{ end }} -{{ end }} diff --git a/layouts/index.html b/layouts/index.html index c346e42..7076542 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,4 +1,5 @@ {{ define "main" }} - {{ .Content }} + {{ partial "title_and_desc.html" . }} + {{ partial "postlist.html" . }} {{ end }} diff --git a/layouts/partials/asside.html b/layouts/partials/asside.html new file mode 100644 index 0000000..58f24e7 --- /dev/null +++ b/layouts/partials/asside.html @@ -0,0 +1,9 @@ +{{define "aside" }} + {{ if .Params.description }}

{{ .Params.description }}

{{ end }} + {{ if or (.Params.author) (.Params.date) }} +

+ {{ if .Params.author }}By {{ .Params.author }}{{ if .Date }}, {{ end }}{{ end }} + {{ if .Date }}{{ .Date.Format "2006-01-02" }}{{ end }} +

+ {{ end }} +{{ end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index a2e54dc..0468397 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,2 +1 @@ - diff --git a/layouts/partials/postlist.html b/layouts/partials/postlist.html new file mode 100644 index 0000000..714ea05 --- /dev/null +++ b/layouts/partials/postlist.html @@ -0,0 +1,13 @@ +{{ range .Pages }} + {{ if not (isset .Params "hide") }} +
+
+

{{ .Title | markdownify }}

+
+ +
+ {{ .Description }} +
+
+ {{ end }} +{{ end }} diff --git a/layouts/partials/sectionlist.html b/layouts/partials/sectionlist.html new file mode 100644 index 0000000..090e6d5 --- /dev/null +++ b/layouts/partials/sectionlist.html @@ -0,0 +1,13 @@ +{{ range .Sections }} + {{ if not (isset .Params "hide") }} +
+
+

{{ .Title | markdownify }}

+
+ +
+ {{ .Description }} +
+
+ {{ end }} +{{ end }} diff --git a/layouts/partials/title_and_content.html b/layouts/partials/title_and_content.html new file mode 100644 index 0000000..757dd5d --- /dev/null +++ b/layouts/partials/title_and_content.html @@ -0,0 +1,4 @@ +
+

{{ .Title | markdownify }}

+{{ .Content }} +
diff --git a/layouts/partials/title_and_desc.html b/layouts/partials/title_and_desc.html new file mode 100644 index 0000000..1d635d2 --- /dev/null +++ b/layouts/partials/title_and_desc.html @@ -0,0 +1,4 @@ +
+

{{ .Title | markdownify }}

+{{ .Description }} +