From ae0c23f3f95c762819a67840e73928a38bdfe5b3 Mon Sep 17 00:00:00 2001 From: BigCoke233 Date: Sat, 17 Jan 2026 01:08:30 +0800 Subject: perf: remove inline scripts and bundle JS files --- layouts/_partials/scripts.html | 85 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 70 insertions(+), 15 deletions(-) (limited to 'layouts/_partials/scripts.html') diff --git a/layouts/_partials/scripts.html b/layouts/_partials/scripts.html index 878ac01e..9da17ba8 100644 --- a/layouts/_partials/scripts.html +++ b/layouts/_partials/scripts.html @@ -1,21 +1,76 @@ -{{ with resources.Get "js/tooltip.js" }} - - -{{ end }} + +{{ $commonJS := slice + (resources.Get "js/tooltip.js") + (resources.Get "js/instantpage.js") +}} +{{ $commonBundle := $commonJS | resources.Concat "js/common-bundle.js" | minify | fingerprint }} + + {{ if not .IsHome }} -{{ with resources.Get "js/inject-footnotes.js" }} - - -{{ end }} + {{ $articleJS := slice + (resources.Get "js/toc.js") + (resources.Get "js/inject-footnotes.js") + (resources.Get "js/back2top.js") + (resources.Get "js/giscus-count.js") + (resources.Get "js/like.js") + }} + {{ $articleBundle := $articleJS | resources.Concat "js/article-bundle.js" | minify | fingerprint }} + {{ end }} -{{ with resources.Get "js/instantpage.js" }} - - -{{ end }} + + + +{{ if and (not .IsHome) .Params.hasAplayer }} + +{{ end }} -- cgit v1.2.3