fix: mermaid script was skipped on home page (#637)

This commit is contained in:
Xin 2025-03-27 22:40:24 +00:00 committed by GitHub
parent 17de708c9f
commit 38c8ee1168
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 3 deletions

View File

@ -1,4 +1,4 @@
<pre class="mermaid hx-mt-6"> <pre class="mermaid hx-mt-6">
{{- .Inner | safeHTML -}} {{ .Inner | htmlEscape | safeHTML }}
</pre> </pre>
{{- .Page.Store.Set "hasMermaid" true -}} {{- .Page.Store.Set "hasMermaid" true -}}

View File

@ -5,8 +5,7 @@
{{- partial "scripts/search.html" . -}} {{- partial "scripts/search.html" . -}}
{{/* Mermaid */}} {{/* Mermaid */}}
{{/* FIXME: need to investigate .Page.Store hasMermaid is set for homepage */}} {{- if (.Store.Get "hasMermaid") -}}
{{- if and (.Page.Store.Get "hasMermaid") (not .Page.IsHome) -}}
{{- partial "scripts/mermaid.html" . -}} {{- partial "scripts/mermaid.html" . -}}
{{- end -}} {{- end -}}