diff --git a/.vscode/extensions.json b/.vscode/extensions.json index a990b7ca..50fddad2 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -5,6 +5,7 @@ "lruihao.hugo-partials-refs", "tamasfe.even-better-toml", "casualjim.gotemplate", - "SomewhatStationery.some-sass" + "SomewhatStationery.some-sass", + "gruntfuggly.todo-tree" ] } diff --git a/layouts/_markup/render-passthrough.html b/layouts/_markup/render-passthrough.html index 4288fdc1..025b911c 100644 --- a/layouts/_markup/render-passthrough.html +++ b/layouts/_markup/render-passthrough.html @@ -6,12 +6,12 @@ {{- $math = dict "enable" false -}} {{- end -}} -{{- /* +{{- /* Mathematical formulas rendering: - KaTeX server-side rendering - MathJax client-side rendering Regular passthrough rendering: - - [todo] support more features in future + - support more features in future */ -}} {{- if $math.enable | and (ne hugo.Context.MarkupScope "home") -}} {{- if eq $math.type "katex" -}} diff --git a/layouts/_partials/base/assets.html b/layouts/_partials/base/assets.html index 7f0fb011..d70e55ce 100644 --- a/layouts/_partials/base/assets.html +++ b/layouts/_partials/base/assets.html @@ -127,7 +127,7 @@ {{- $math := .Store.Get "math" -}} {{- if .Store.Get "hasKaTeX" | and (not $isArchivesOrOffline) -}} {{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}} - {{- dict "Source" $source "Fingerprint" $fingerprint "Preload" true | dict "Page" . "Data" | partial "store/style.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}} {{- /* Copy-tex extension */ -}} {{- if $math.katex.copyTex -}} {{- $source := $cdn.katexCopyTexJS | default "lib/katex/copy-tex.min.js" -}} @@ -178,7 +178,7 @@ {{- /* Mapbox GL */ -}} {{- if .Store.Get "hasMapbox" -}} {{- $source := $cdn.mapboxGLCSS | default "lib/mapbox-gl/mapbox-gl.css" -}} - {{- dict "Source" $source "Minify" hugo.IsProduction "Fingerprint" $fingerprint "Preload" true | dict "Page" . "Data" | partial "store/style.html" -}} + {{- dict "Source" $source "Minify" hugo.IsProduction "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}} {{- $source = $cdn.mapboxGLJS | default "lib/mapbox-gl/mapbox-gl.js" -}} {{- dict "Source" $source "Minify" hugo.IsProduction "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} {{- dict "Source" "lib/mapbox-gl/mapbox-gl-language.js" "Minify" hugo.IsProduction "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} @@ -190,7 +190,7 @@ {{- if (.Store.Get "hasAplayer") | or (.Store.Get "hasMusic") -}} {{- /* APlayer */ -}} {{- $source := $cdn.aplayerCSS | default "lib/aplayer/APlayer.min.css" -}} - {{- dict "Source" $source "Fingerprint" $fingerprint "Preload" true | dict "Page" . "Data" | partial "store/style.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}} {{- $options := dict "targetPath" "lib/aplayer/dark.min.css" -}} {{- dict "Source" "lib/aplayer/dark.scss" "ToCSS" $options "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}} {{- $source := $cdn.aplayerJS | default "lib/aplayer/APlayer.min.js" -}} diff --git a/layouts/_partials/base/head/index.html b/layouts/_partials/base/head/index.html index 531201d3..589a4eec 100644 --- a/layouts/_partials/base/head/index.html +++ b/layouts/_partials/base/head/index.html @@ -121,7 +121,7 @@ {{- $options = dict "Context" . "ToCSS" $toCSS | merge $options -}} {{- partial "plugin/style.html" $options -}} -{{- /* Theme CSS */ -}} +{{- /* Theme main CSS */ -}} {{- $options := dict "Source" "scss/main.scss" "Fingerprint" $fingerprint -}} {{- $toCSS := dict "targetPath" "css/main.min.css" "enableSourceMap" true -}} {{- $options = dict "Context" . "ToCSS" $toCSS | merge $options -}} @@ -137,6 +137,13 @@ {{- $options := dict "Source" $source "Fingerprint" $fingerprint "Preload" true -}} {{- partial "plugin/style.html" $options -}} +{{- /* Preload main theme bundle */ -}} +{{- $mainResource := dict "Resource" (resources.Get "js/main.ts") "Build" true | partial "function/js-build.html" -}} +{{- with $fingerprint -}} + {{- $mainResource = $mainResource | fingerprint . -}} +{{- end -}} + + {{- /* ========== SEO: Structured Data (Schema.org) ========== */ -}} {{- $params := partial "function/params.html" -}} diff --git a/layouts/baseof.html b/layouts/baseof.html index 5dec115c..5eeb3582 100644 --- a/layouts/baseof.html +++ b/layouts/baseof.html @@ -11,7 +11,6 @@ {{ block "title" . }}{{ .Site.Title }}{{ end }} {{- partial "base/head/index.html" . -}} - {{- /* TODO preload script https://developer.mozilla.org/zh-CN/docs/Web/HTML/Attributes/rel/preload */ -}} {{- /* Body wrapper */ -}}