diff options
| author | roninro <liumy.f@foxmail.com> | 2022-07-28 20:04:57 +0800 |
|---|---|---|
| committer | roninro <liumy.f@foxmail.com> | 2022-07-28 20:04:57 +0800 |
| commit | 04a4ceaedfad5cccd3961e9f71833e1382dcf2fc (patch) | |
| tree | 31d475b10af3d6d6953b4af7efa24c8f0057581e | |
| parent | 25bf7c8342ba8ecb59363bf6043dc62a3585bf87 (diff) | |
support custom js css
| -rw-r--r-- | exampleSite/config.toml | 4 | ||||
| -rw-r--r-- | layouts/_default/baseof.html | 18 | ||||
| -rw-r--r-- | layouts/partials/footer.html | 4 |
3 files changed, 25 insertions, 1 deletions
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 }} <link rel="stylesheet" href="{{ $style.Permalink }}"> + + {{ range .Site.Params.custom_css -}} + {{ $custom_template := resources.Get . }} + {{ if $custom_template }} + {{ $custom_style := $custom_template | resources.ToCSS | resources.Minify }} + <link rel="stylesheet" href="{{ $custom_style.RelPermalink }}"> + {{ end }} + {{ end }} + <!-- custom js --> + {{ range .Site.Params.custom_js -}} + {{ $custom_template := resources.Get . }} + {{ if $custom_template }} + {{ $custom_js := $custom_template | resources.Minify | resources.Fingerprint }} + <script defer src="{{ $custom_js.RelPermalink }}"></script> + {{ end }} + {{ end }} + </head> <!-- hack iOS CSS :active style --> + <body ontouchstart=""> {{ $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 @@ } }); }); -</script>
\ No newline at end of file +</script> + +{{ template "_internal/google_analytics.html" . }}
\ No newline at end of file |
