Feat: add custom partials options params.customPartials

This commit is contained in:
Cell
2024-09-25 15:59:37 +08:00
parent fabe057f61
commit 954d86432f
4 changed files with 52 additions and 8 deletions
+14
View File
@@ -825,6 +825,20 @@ enableEmoji = true
# whether to show the full text content in feed.
fullText = true
# FixIt 0.3.12 | NEW Custom partials config
# Custom partials must be stored in the /layouts/partials/ directory.
# Depends on open custom blocks https://fixit.lruihao.cn/references/blocks/
[params.customPartials]
head = []
profile = []
aside = []
comment = []
footer = []
widgets = []
assets = []
postFooterBefore = []
postFooterAfter = []
# FixIt 0.2.15 | NEW Developer options
# Select the scope named `public_repo` to generate personal access token,
# Configure with environment variable `HUGO_PARAMS_GHTOKEN=xxx`, see https://gohugo.io/functions/os/getenv/#examples
-1
View File
@@ -1,5 +1,4 @@
{{- partial "init/index.html" . -}}
{{- partial "custom.html" . -}}
<!DOCTYPE html>
<html itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.LanguageCode }}">
+37 -6
View File
@@ -1,31 +1,62 @@
{{- /*
To avoid upgrade conflicts and facilitate the reference of theme components,
it's strongly recommended to copy this file from the theme to your project and override it.
*/ -}}
{{- define "custom-head" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.head -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-profile" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.profile -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-aside" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.aside -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-comment" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.comment -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-footer" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.footer -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-widgets" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.widgets -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-assets" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.assets -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-post__footer:before" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.postFooterBefore -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-post__footer:after" -}}
{{- end -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.postFooterAfter -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
+1 -1
View File
@@ -1,4 +1,4 @@
{{- .Scratch.Set "version" "v0.3.12-185c6803" -}}
{{- .Scratch.Set "version" "v0.3.12-314d24a3" -}}
{{- .Scratch.Set "this" dict -}}
{{- partial "init/detection-env.html" . -}}