From 627f174ae490783afcf32ea26250cd8cc16abeb7 Mon Sep 17 00:00:00 2001 From: mark Date: Tue, 14 Nov 2023 12:06:26 +0100 Subject: [PATCH 1/4] Fix duplicate rendering of section body --- layouts/partials/utilities/GetSections.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/layouts/partials/utilities/GetSections.html b/layouts/partials/utilities/GetSections.html index 3cafe1af1..8be355d55 100644 --- a/layouts/partials/utilities/GetSections.html +++ b/layouts/partials/utilities/GetSections.html @@ -48,7 +48,8 @@ {{- $thumbnail := (or (and (reflect.IsMap $sectionPage.Params.Thumbnail) $sectionPage.Params.Thumbnail.url) $sectionPage.Params.Thumbnail) -}} {{- $icon := $sectionPage.Params.Icon -}} - {{- $content := $sectionPage.Content -}} + {{- $content := "" -}} + {{ if not $sectionPage.IsSection }}{{ $content = $sectionPage.Content }}{{ end -}} {{- $sectionTitle := strings.FirstUpper $sectionPage.Type -}} {{- $moreTitle := "" -}} {{- with (index site.Params.sections $section) -}} From 9e97f063e54abccaef47a53ff9478786c27ee6f7 Mon Sep 17 00:00:00 2001 From: mark Date: Tue, 14 Nov 2023 12:06:41 +0100 Subject: [PATCH 2/4] Update build stats --- exampleSite/hugo_stats.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/exampleSite/hugo_stats.json b/exampleSite/hugo_stats.json index 0be29a574..dc180cc13 100644 --- a/exampleSite/hugo_stats.json +++ b/exampleSite/hugo_stats.json @@ -120,12 +120,15 @@ "col-8", "col-9", "col-auto", + "col-lg-2", "col-lg-4", "col-lg-8", "col-md-10", "col-md-2", + "col-md-3", "col-md-4", "col-md-8", + "col-md-9", "col-md-auto", "col-sm-12", "col-sm-3", @@ -141,6 +144,7 @@ "d-grid", "d-inline", "d-inline-flex", + "d-lg-block", "d-md-block", "d-md-flex", "d-md-none", @@ -332,6 +336,7 @@ "row", "row-cols-1", "row-cols-2", + "row-cols-lg-3", "row-cols-md-2", "row-cols-md-3", "row-cols-sm-2", @@ -341,6 +346,7 @@ "search-suggestions", "shadow", "show", + "sidebar-overflow", "slide", "small", "spinner-border", From d32fdfa987feafbb819808642439af83a3c270e3 Mon Sep 17 00:00:00 2001 From: mark Date: Tue, 14 Nov 2023 12:09:16 +0100 Subject: [PATCH 3/4] Make page breakpoint configurable --- config/_default/params.toml | 1 + exampleSite/config/_default/params.toml | 1 + layouts/_default/baseof.html | 3 ++ layouts/_default/list/body.html | 12 +++++--- layouts/_default/single.html | 30 +++++++------------ layouts/partials/assets/card-group.html | 9 +++--- layouts/partials/utilities/GetBreakpoint.html | 21 +++++++++++++ layouts/tags/list.html | 11 +++---- 8 files changed, 56 insertions(+), 32 deletions(-) create mode 100644 layouts/partials/utilities/GetBreakpoint.html diff --git a/config/_default/params.toml b/config/_default/params.toml index 962ce4d76..b2741fd9f 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -8,6 +8,7 @@ endorse = true footerBelowFold = false loading = "lazy" + breakpoint = "md" [main.externalLinks] cue = false tab = false diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 1ce5bf833..b9c43c4fa 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -6,6 +6,7 @@ canonifyAssetsURLs = false footerBelowFold = false loading = "lazy" + breakpoint = "md" [main.externalLinks] cue = true tab = true diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 829722201..fef9b1b10 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -48,6 +48,9 @@ {{ $sections := partial "utilities/GetSections.html" (dict "page" . "loading" $loading) }} {{- $.Scratch.Set "sections" $sections -}} +{{- /* Define main breakpoint */ -}} +{{- $.Scratch.Set "breakpoint" (partial "utilities/GetBreakpoint.html") }} + diff --git a/layouts/_default/list/body.html b/layouts/_default/list/body.html index 3fd3ff394..cbe11b6df 100644 --- a/layouts/_default/list/body.html +++ b/layouts/_default/list/body.html @@ -1,9 +1,10 @@ {{- $sections := $.Scratch.Get "sections" -}} {{- $fullCover := $.Scratch.Get "fullCover" -}} +{{- $breakpoint := $.Scratch.Get "breakpoint" -}} {{- $layout := .Params.layout -}} -
-
+
+
{{ if not .IsHome }} {{ with .Title }}

{{ . }}

{{ end }} {{ end }} @@ -15,9 +16,12 @@ {{- if $fullCover }}{{ $loading = site.Params.main.loading }}{{ end }} {{ end }} {{- $content := partial "utilities/ProcessContent" (dict "page" . "raw" .RawContent "loading" $loading) -}} - {{ $content | safeHTML }} + {{- $content | safeHTML -}} {{ if and (and $sections (eq (len $sections) 1)) (not $content) }}

{{- T "emptyList" }}.

{{ end }}
-
+
+ {{/* Empty in default layout */}} +
+
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 730eefbaa..c42994012 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,10 +1,11 @@ {{- define "partials/single-main.html" -}} + {{- $breakpoint := $.Scratch.Get "breakpoint" -}} {{ if .Site.Params.navigation.breadcrumb }}{{ partial "assets/breadcrumb.html" . }}{{ end -}} {{ .Render "single/header" }} {{- if and .Site.Params.navigation.toc .Params.includeToc | default true -}} -
{{ partial "assets/toc-dropdown.html" . }}
+
{{ partial "assets/toc-dropdown.html" . }}
{{- end -}} {{ .Render "single/body" }} @@ -18,6 +19,7 @@ {{ define "main" -}} {{- $menu := .Scratch.Get "sidebar" -}} {{- $version := .Scratch.Get "version" -}} + {{- $breakpoint := $.Scratch.Get "breakpoint" -}} {{ $sidebar := "" }} {{- $hasSidebar := .Site.Params.navigation.sidebar | default true -}} @@ -38,34 +40,24 @@
{{ strings.FirstUpper $.Section {{ end }}
- {{ if and $menu $hasSidebar -}} -
-