Feat: open more custom blocks for posts page

This commit is contained in:
Cell
2024-12-27 15:38:12 +08:00
parent 469af95f10
commit 30a67c4b52
5 changed files with 46 additions and 2 deletions
+4
View File
@@ -957,6 +957,10 @@ enableEmoji = true
footer = []
widgets = []
assets = []
postTocBefore = []
postTocAfter = []
postContentBefore = []
postContentAfter = []
postFooterBefore = []
postFooterAfter = []
+28
View File
@@ -61,6 +61,34 @@
{{- end -}}
{{- end -}}
{{- define "custom-post__toc:before" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.postTocBefore -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-post__toc:after" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.postTocAfter -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-post__content:before" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.postContentBefore -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-post__content:after" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.postContentAfter -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-post__footer:before" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.postFooterBefore -}}
+1 -1
View File
@@ -1,4 +1,4 @@
{{- .Scratch.Set "version" "v0.3.17-21750077" -}}
{{- .Scratch.Set "version" "v0.3.17-469af95f" -}}
{{- .Scratch.Set "this" dict -}}
{{- partial "init/detection-env.html" . -}}
+1 -1
View File
@@ -5,7 +5,7 @@
<span class="post-author">
{{- $content := $author.name | default "Anonymous" -}}
{{- $icon := dict "Class" "fa-solid fa-user-circle" -}}
{{- /* Deprecate $params.authorAvatar in favor of $params.showAvatar and dd front matter gravatar {bool} */ -}}
{{- /* Deprecate $params.authorAvatar in favor of $params.showAvatar and add front matter gravatar {bool} */ -}}
{{- if $author.avatar | and $params.authorAvatar -}}
{{- $content = printf "%v&nbsp;%v" (dict "Src" $author.avatar "Class" "avatar" "Alt" $content "Width" 20 "Height" 20 | partial "plugin/image.html") $content -}}
{{- $icon = "" -}}
+12
View File
@@ -159,6 +159,9 @@
</div>
{{- end -}}
{{- /* Custom block before post content */ -}}
{{- block "custom-post__content:before" . }}{{ end -}}
{{- /* Content */ -}}
{{- $content := dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
<div class="content" id="content"{{ with $params.endFlag }} data-end-flag="{{ . }}"{{ end }}>
@@ -169,6 +172,9 @@
{{- end -}}
</div>
{{- /* Custom block after post content */ -}}
{{- block "custom-post__content:after" . }}{{ end -}}
{{- /* Related Content */ -}}
{{- partial "single/related.html" . -}}
@@ -203,6 +209,9 @@
</article>
<aside class="toc" id="toc-auto" aria-label="{{ T "single.contents" }}">
{{- /* Custom block before post toc */ -}}
{{- block "custom-post__toc:before" . }}{{ end -}}
{{- /* Auto TOC */ -}}
{{- if $showToc -}}
<h2 class="toc-title{{ with $params.password }} encrypted-hidden{{ end }}">
@@ -211,5 +220,8 @@
</h2>
<div class="toc-content{{ if eq $toc.auto false }} always-active{{ end }}{{ with $params.password }} encrypted-hidden{{ end }}" id="toc-content-auto"></div>
{{- end -}}
{{- /* Custom block after post toc */ -}}
{{- block "custom-post__toc:after" . }}{{ end -}}
</aside>
{{- end -}}