From 5e7c8b51ac6b6c64e66ad6c2a28f670a2086aa18 Mon Sep 17 00:00:00 2001 From: Reorx Date: Thu, 19 May 2022 22:31:40 +0800 Subject: [PATCH] split page_footer.html from footer.html to run scripts only when IsPage == true --- layouts/partials/footer.html | 156 ++++-------------------------- layouts/partials/page_footer.html | 127 ++++++++++++++++++++++++ 2 files changed, 146 insertions(+), 137 deletions(-) create mode 100644 layouts/partials/page_footer.html diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 662fd2f..d78a2ee 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -91,133 +91,6 @@ {{- end }} -{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (.Param "ShowCodeCopyButtons")) }} - -{{- end }} - - - - - {{- /* Base64Email */}} {{- if (.Param "MaskedEmail") }} {{- end -}} -{{- if (.Param "EnableImageZoom") }} + +{{/* Clear ToC Scroll */}} + + +{{/* Load mediumZoom script */}} +{{/* It has to be loaded here because of the data-no-instant attribute */}} {{- $imagezoom := resources.Get "js/medium-zoom.min.js" }} - -{{- end }} -{{- if not (.Param "noComments") }} -{{ partial "comments_js.html" . }} -{{ end }} +{{- if .IsPage }} + {{- partial "page_footer.html" . }} +{{- else }} +{{- end}} {{- /* Search */}} {{- if (eq .Layout `search`) -}} diff --git a/layouts/partials/page_footer.html b/layouts/partials/page_footer.html new file mode 100644 index 0000000..7420ec9 --- /dev/null +++ b/layouts/partials/page_footer.html @@ -0,0 +1,127 @@ + +{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (.Param "ShowCodeCopyButtons")) }} + +{{- end }} + + + +{{/* ToC Scroll */}} + + +{{- if (.Param "EnableImageZoom") }} + +{{- end }} + +{{- if not (.Param "noComments") }} +{{ partial "comments_js.html" . }} +{{ end }}