diff --git a/assets/scss/abstracts/_variables.scss b/assets/scss/abstracts/_variables.scss
index 275e983..0194e40 100644
--- a/assets/scss/abstracts/_variables.scss
+++ b/assets/scss/abstracts/_variables.scss
@@ -26,5 +26,5 @@ $code-icon-width: 1.75rem !default;
/* fonts */
-$font-family-base: 'Source Sans 3', 'Microsoft Yahei', sans-serif !default;
+$font-family-base: 'Source Sans Pro', 'Microsoft Yahei', sans-serif !default;
$font-family-heading: Lato, 'Microsoft Yahei', sans-serif !default;
diff --git a/assets/scss/main.bundle.scss b/assets/scss/main.bundle.scss
index 0637e3c..b6e7382 100644
--- a/assets/scss/main.bundle.scss
+++ b/assets/scss/main.bundle.scss
@@ -1,5 +1,2 @@
@use 'bootstrap/bootstrap';
-@use 'main';
-@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css');
-@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap');
-@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap');
\ No newline at end of file
+@use 'main';
\ No newline at end of file
diff --git a/hugo.toml b/hugo.toml
index 865a1b3..38f5cb3 100644
--- a/hugo.toml
+++ b/hugo.toml
@@ -23,7 +23,7 @@ path = "github.com/gohugoio/hugo-mod-bootstrap-scss/v5"
toc = true
[params.assets]
- self_host = true
+ self_host = false
[params.social]
name = "Yifan"
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index abe6d05..7454096 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -8,11 +8,9 @@
{{ $sass := resources.Get "scss/main.bundle.scss" }}
{{ $style := $sass | toCSS $opts | minify | fingerprint }}
- {{ $jsFiles := resources.Match "js/**/*.js" }}
- {{ $jsBundle := $jsFiles | resources.Concat "js/bundle.js" | minify | fingerprint }}
-
+ {{ partial "head.html" . }}
{{ partial "sidebar.html" . }}
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 9b62135..b509d08 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -1,5 +1,11 @@
{{ $origin := cond (eq .Site.Params.self_host true) "basic" "cors" }}
{{ $data := index .Site.Data.origin $origin }}
+{{- $jsOpts := dict
+ "target" "es2015"
+ "minify" (eq hugo.Environment "production")
+-}}
+{{- $themeOpts := merge $jsOpts (dict "global" "Theme") -}}
+{{- $theme := resources.Get "js/modules/theme.js" | js.Build $themeOpts -}}
@@ -47,7 +53,7 @@
{{ if not site.Params.assets.self_host }}
{{ range site.Data.origin.cors.resource_hints }}
{{ range .links }}
-
+
{{ end }}
{{ end }}
{{ end }}
@@ -88,7 +94,7 @@
{{ end }}
-
+
{{ partial "js-selector.html" . }}
diff --git a/layouts/partials/js-selector.html b/layouts/partials/js-selector.html
new file mode 100644
index 0000000..a044168
--- /dev/null
+++ b/layouts/partials/js-selector.html
@@ -0,0 +1,105 @@
+{{ $origin := cond (eq .Site.Params.self_host true) "basic" "cors" }}
+{{ $data := index .Site.Data.origin $origin }}
+{{ $is_home := false }}
+{{ if or (eq .RelPermalink "/") (eq .RelPermalink (relLangURL "/")) }}
+ {{ $is_home = true }}
+{{ end }}
+{{- $jsOpts := dict
+ "target" "es2015"
+ "minify" (eq hugo.Environment "production")
+-}}
+
+{{ $urls := slice }}
+
+
+{{ $urls = $urls | append $data.search.js }}
+
+
+
+{{ if or (eq .Type "post") (eq .Type "page") $is_home }}
+ {{ with $data.lazyPolyfill.js }}
+ {{ $urls = $urls | append . }}
+ {{ end }}
+
+ {{ if not $is_home }}
+
+ {{ with $data.glightbox.js }}
+ {{ $urls = $urls | append . }}
+ {{ end }}
+ {{ with $data.clipboard.js }}
+ {{ $urls = $urls | append . }}
+ {{ end }}
+ {{ end }}
+{{ end }}
+
+{{ if or $is_home (eq .Type "post") (eq .Type "archives") (eq .Type "category") (eq .Type "tag") }}
+ {{ $locale := strings.TrimSuffix (path.Ext .Lang) .Lang }}
+
+ {{ with $data.dayjs.js.common }}
+ {{ $urls = $urls | append . }}
+ {{ end }}
+ {{ with replace $data.dayjs.js.locale ":LOCALE" $locale }}
+ {{ $urls = $urls | append . }}
+ {{ end }}
+ {{ with $data.dayjs.js.relativeTime }}
+ {{ $urls = $urls | append . }}
+ {{ end }}
+ {{ with $data.dayjs.js.localizedFormat }}
+ {{ $urls = $urls | append . }}
+ {{ end }}
+{{ end }}
+
+{{ if or (strings.Contains .Content "
+{{ end }}
+
+{{ $js := "commons" }}
+{{ if $is_home }}
+ {{ $js = "home" }}
+{{ else if eq .Type "categories" }}
+ {{ $js = "categories" }}
+{{ else if eq .Type "post" }}
+ {{ $js = "post" }}
+{{ else if eq .Type "page" }}
+ {{ $js = "page" }}
+{{ else if or (eq .Type "archives") (eq .Type "category") (eq .Type "tag") }}
+ {{ $js = "misc" }}
+{{ end }}
+
+{{- $script := resources.Get (printf "js/%s.js" $js) | js.Build $jsOpts -}}
+
+
+{{ if .Params.math }}
+
+ {{ $mathjaxConfig := resources.Get "js/data/mathjax.js" | minify | fingerprint }}
+
+
+ {{ $mathjax := (index site.Data.origin site.Params.cdn).mathjax.js }}
+
+{{ end }}
+
+
+{{ if eq .Type "post" }}
+ {{ $provider := site.Params.pageviews.provider }}
+ {{ if and $provider (ne $provider "") }}
+ {{ if eq $provider "goatcounter" }}
+ {{ if and site.Params.analytics.goatcounter.id (ne site.Params.analytics.goatcounter.id "") }}
+ {{ partial (printf "pageviews/%s.html" $provider) . }}
+ {{ end }}
+ {{ end }}
+ {{ end }}
+{{ end }}
\ No newline at end of file