From 04a4ceaedfad5cccd3961e9f71833e1382dcf2fc Mon Sep 17 00:00:00 2001 From: roninro Date: Thu, 28 Jul 2022 20:04:57 +0800 Subject: support custom js css --- exampleSite/config.toml | 4 ++++ layouts/_default/baseof.html | 18 ++++++++++++++++++ layouts/partials/footer.html | 4 +++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 0c9877c..854629b 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -73,6 +73,10 @@ keywords = "blog,developer,personal" img_home = "/img/home-bg.jpg" img_404 = "/img/404-bg.jpg" +custom_js = [] +custom_css = [] # ["css/custom.css"] Add your file to assets folder [assets/css/custom.css] + + [params.sidebar] enable = true avatar = "/img/home-bg.jpg" diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 2b315e1..2711fee 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -32,9 +32,27 @@ "sass")) }} {{ $style := resources.Get "sass/main.scss" | resources.ToCSS $options }} + + {{ range .Site.Params.custom_css -}} + {{ $custom_template := resources.Get . }} + {{ if $custom_template }} + {{ $custom_style := $custom_template | resources.ToCSS | resources.Minify }} + + {{ end }} + {{ end }} + + {{ range .Site.Params.custom_js -}} + {{ $custom_template := resources.Get . }} + {{ if $custom_template }} + {{ $custom_js := $custom_template | resources.Minify | resources.Fingerprint }} + + {{ end }} + {{ end }} + + {{ $header_img := .Param "header_img" }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 9f296aa..5eda267 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -144,4 +144,6 @@ } }); }); - \ No newline at end of file + + +{{ template "_internal/google_analytics.html" . }} \ No newline at end of file -- cgit v1.2.3