From 37b996572636df60dbd99265d7956625fc03b5cc Mon Sep 17 00:00:00 2001 From: Eltrac Date: Thu, 27 Mar 2025 11:43:44 +0800 Subject: refactor: use define "main" to replace start/end partials Former-commit-id: 6576dc46469cdf1fb25cedf2699fe4ba7002a5ef --- layouts/_default/baseof.html | 13 +++++++++++++ layouts/_default/section.html | 4 ++-- layouts/_default/single.html | 4 ++-- layouts/_default/taxonomy.html | 4 ++-- layouts/_default/term.html | 4 ++-- 5 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 layouts/_default/baseof.html (limited to 'layouts/_default') diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 00000000..ebbb6ec7 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,13 @@ + + +{{ partial "head.html" . }} + +
+ {{ block "main" . }}{{ end }} +
+ {{ partial "scripts.html" . }} + {{ if .Site.Params.extraBody }} + {{ .Site.Params.extraBody | safeHTML }} + {{ end }} + + diff --git a/layouts/_default/section.html b/layouts/_default/section.html index de06b2aa..8a458078 100644 --- a/layouts/_default/section.html +++ b/layouts/_default/section.html @@ -1,4 +1,4 @@ -{{ partial "snippets/document-start.html" . }} +{{ define "main" }}
{{ partial "components/breadcrumbs.html" . }}
@@ -58,4 +58,4 @@ {{ end }}
-{{ partial "snippets/document-end.html" . }} +{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 3be45f40..13c56ada 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,4 +1,4 @@ -{{ partial "snippets/document-start.html" . }} +{{ define "main" }}
-{{ partial "snippets/document-end.html" . }} +{{ end }} diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html index a9f53c92..b192c63c 100644 --- a/layouts/_default/taxonomy.html +++ b/layouts/_default/taxonomy.html @@ -1,4 +1,4 @@ -{{ partial "snippets/document-start.html" . }} +{{ define "main" }}
{{ partial "header.html" . }} @@ -34,4 +34,4 @@ {{ end }}
-{{ partial "snippets/document-end.html" . }} +{{ end }} diff --git a/layouts/_default/term.html b/layouts/_default/term.html index 2c23cb5b..8e935334 100644 --- a/layouts/_default/term.html +++ b/layouts/_default/term.html @@ -1,4 +1,4 @@ -{{ partial "snippets/document-start.html" . }} +{{ define "main" }}
{{ partial "components/breadcrumbs.html" . }} @@ -33,4 +33,4 @@
-{{ partial "snippets/document-end.html" . }} +{{ end }} -- cgit v1.2.3