From 4cf3f2e6297878a4a6303a886e24addd5cf4580f Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Wed, 6 Sep 2023 21:44:11 +0200 Subject: Simplify and consolidate page styles Use the section template instead of defining a new page type for the about page. In general I could build on pieces of markdown for each subsection. --- layouts/404.html | 14 ++++---------- layouts/_default/about.html | 12 ++++++++++++ layouts/_default/baseof.html | 3 ++- layouts/_default/list.html | 8 ++++---- layouts/_default/single.html | 11 +++-------- layouts/index.html | 7 +++---- layouts/partials/header.html | 2 +- layouts/partials/open_section.html | 5 ----- layouts/section_page/single.html | 10 ---------- 9 files changed, 29 insertions(+), 43 deletions(-) create mode 100644 layouts/_default/about.html delete mode 100644 layouts/partials/open_section.html delete mode 100644 layouts/section_page/single.html diff --git a/layouts/404.html b/layouts/404.html index 754d082..46f4883 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,12 +1,8 @@ -{{ define "main"}} -
- -

Page not found

- - {{/* Suggest recently published pages to the user. */}} - -

Perhaps you were looking for one of these?

+{{ define "hero" }} +{{ partial "hero.html" (dict "Title" .Title "Content" "Perhaps you were looking for one of these?") }} +{{ end }} +{{ define "main"}} {{ $query := where (where (where (where site.RegularPages.ByDate.Reverse "Title" "!=" "") "Kind" "in" (slice "page" "section")) "Params.private" "!=" true) "Permalink" "!=" "" }} {{ $count := len $query }} {{ if gt $count 0 }} @@ -15,6 +11,4 @@ {{ end }} {{ end }} -
- {{ end }} diff --git a/layouts/_default/about.html b/layouts/_default/about.html new file mode 100644 index 0000000..6fdfaba --- /dev/null +++ b/layouts/_default/about.html @@ -0,0 +1,12 @@ +{{ define "hero" }} +{{ partial "hero.html" . }} +{{ end }} + +{{ define "main" }} +{{ range .Paginator.Pages }} +
+{{ .Content }} +
+{{ end }} + +{{ end }} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 81ba4d7..b0a5999 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -3,7 +3,8 @@ {{- partial "head.html" . -}} {{- partial "header.html" . -}} -
+ {{ block "hero" . }} {{ end }} +
{{- block "main" . }}{{- end }}
{{- partial "footer.html" . -}} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 8737066..f8b838d 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,10 +1,10 @@ -{{ define "main" }} -
-{{ partial "open_section.html" . }} +{{ define "hero" }} +{{ partial "hero.html" . }} +{{ end }} +{{ define "main" }} {{ range .Paginator.Pages.ByPublishDate.Reverse }} {{ partial "post.html" . }} {{ end }} {{ partial "pagination.html" . }} -
{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 894caf5..d12dd07 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,5 +1,4 @@ {{ define "main" }} -

{{ .Title }} @@ -25,15 +24,11 @@ {{ if isset .Params "metadata" }} {{ partial "metadata.html" . }} {{ end }} - -

- -
+
{{ .Content }} -
-
-
+
+
{{ if isset .Params "metadata" }} {{ partial "author_card" . }} {{ end }} diff --git a/layouts/index.html b/layouts/index.html index a21b7c4..889d236 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,10 +1,10 @@ -{{ define "main" }} +{{ define "hero" }} {{ partial "hero.html" . }} +{{ end }} +{{ define "main" }} {{ range $index, $element := where .Pages "Type" "in" .Site.Params.mainSections }} -
-{{ partial "open_section.html" . }} {{ range first .Params.index_show .Pages.ByPublishDate.Reverse }} {{ partial "post.html" . }} {{ end }} @@ -13,6 +13,5 @@ See all
-
{{ end }} {{ end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 0778292..c0418b2 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -14,7 +14,7 @@ -