diff options
| author | Eltrac <hi@guhub.cn> | 2025-03-27 11:43:44 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-03-27 11:43:44 +0800 |
| commit | 6576dc46469cdf1fb25cedf2699fe4ba7002a5ef (patch) | |
| tree | 72562fb357ee9f146933623205f9d779f79f47a8 | |
| parent | ba9d8499edaddbc7c542a7c543f490fa1bc7c255 (diff) | |
refactor: use define "main" to replace start/end partials
| -rw-r--r-- | layouts/_default/baseof.html | 13 | ||||
| -rw-r--r-- | layouts/_default/section.html | 4 | ||||
| -rw-r--r-- | layouts/_default/single.html | 4 | ||||
| -rw-r--r-- | layouts/_default/taxonomy.html | 4 | ||||
| -rw-r--r-- | layouts/_default/term.html | 4 | ||||
| -rw-r--r-- | layouts/cards/section.html | 4 | ||||
| -rw-r--r-- | layouts/cards/single.html | 4 | ||||
| -rw-r--r-- | layouts/index.html | 4 | ||||
| -rw-r--r-- | layouts/partials/snippets/document-end.html | 7 | ||||
| -rw-r--r-- | layouts/partials/snippets/document-start.html | 5 |
10 files changed, 27 insertions, 26 deletions
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 @@ +<!DOCTYPE html> +<html lang="{{ .Site.LanguageCode }}" prefix="og: http://ogp.me/ns#"> +{{ partial "head.html" . }} +<body> + <main> + {{ block "main" . }}{{ end }} + </main> + {{ partial "scripts.html" . }} + {{ if .Site.Params.extraBody }} + {{ .Site.Params.extraBody | safeHTML }} + {{ end }} +</body> +</html> 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" }} <article class="posts"> {{ partial "components/breadcrumbs.html" . }} <div id="posts-archive" class="posts-list"> @@ -58,4 +58,4 @@ {{ end }} </div> </article> -{{ 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" }} <article class="post {{ .Site.Language.LanguageName }}" id="article" @@ -71,4 +71,4 @@ </script> </article> -{{ 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" }} <article class="taxonomy"> {{ partial "header.html" . }} @@ -34,4 +34,4 @@ {{ end }} </section> </article> -{{ 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" }} <article class="posts termlist-page"> {{ partial "components/breadcrumbs.html" . }} @@ -33,4 +33,4 @@ </ul> </div> </article> -{{ partial "snippets/document-end.html" . }} +{{ end }} diff --git a/layouts/cards/section.html b/layouts/cards/section.html index ab5a49bb..011985d7 100644 --- a/layouts/cards/section.html +++ b/layouts/cards/section.html @@ -1,4 +1,4 @@ -{{ partial "snippets/document-start.html" . }} +{{ define "main" }} <article class="card-list"> {{ partial "header.html" . }} <div id="cards-section"> @@ -25,4 +25,4 @@ {{- end }} </div> </article> -{{ partial "snippets/document-end.html" . }} +{{ end }} diff --git a/layouts/cards/single.html b/layouts/cards/single.html index 0651c511..cdfb4064 100644 --- a/layouts/cards/single.html +++ b/layouts/cards/single.html @@ -1,4 +1,4 @@ -{{ partial "snippets/document-start.html" . }} +{{ define "main" }} <article class="card-page {{ .Site.Language.LanguageName }}" id="article" @@ -47,4 +47,4 @@ {{ end }} </div> </article> -{{ partial "snippets/document-end.html" . }} +{{ end }} diff --git a/layouts/index.html b/layouts/index.html index 47f2fb03..e866d0e2 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,4 +1,4 @@ -{{ partial "snippets/document-start.html" . }} +{{ define "main" }} <article class="posts"> {{ partial "header.html" . }} @@ -69,4 +69,4 @@ </div> </article> {{ partial "footer.html" . }} -{{ partial "snippets/document-end.html" . }} +{{ end }} diff --git a/layouts/partials/snippets/document-end.html b/layouts/partials/snippets/document-end.html deleted file mode 100644 index 9e4940b1..00000000 --- a/layouts/partials/snippets/document-end.html +++ /dev/null @@ -1,7 +0,0 @@ - </main> - {{ partial "scripts.html" . }} - {{ if .Site.Params.extraBody }} - {{ .Site.Params.extraBody | safeHTML }} - {{ end }} - </body> -</html> diff --git a/layouts/partials/snippets/document-start.html b/layouts/partials/snippets/document-start.html deleted file mode 100644 index 56b12280..00000000 --- a/layouts/partials/snippets/document-start.html +++ /dev/null @@ -1,5 +0,0 @@ -<!DOCTYPE html> -<html lang="{{ .Site.LanguageCode }}" prefix="og: http://ogp.me/ns#"> -{{ partial "head.html" . }} -<body> - <main id="swup" class="transition-fade">
\ No newline at end of file |
