From 0cfdc6ed6251a98792fc5bc8a3828a0b1479605f Mon Sep 17 00:00:00 2001
From: weru <fromweru@gmail.com>
Date: Fri, 12 Mar 2021 15:33:40 +0000
Subject: [PATCH] enable custom assets #38

---
 layouts/partials/scripts.html       |    9 +++++++++
 layouts/partials/hooks/scripts.html |    1 +
 layouts/partials/head.html          |    9 ++++++++-
 layouts/partials/hooks/head.html    |    1 +
 4 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 96cee34..256a084 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -23,6 +23,12 @@
 <link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}">
 
 {{- $sp := .Site.Params }}
+{{- with $sp.customCSS }}
+  {{- range . -}}
+  <link rel="stylesheet" href="{{ . }}">
+  {{- end }}
+{{- end }}
+
 {{ with $sp.metaThemeColor }}
   <meta name="theme-color" content="{{.}}">
 {{ end }}
@@ -33,4 +39,5 @@
   <meta name="description" content="{{ .Summary | plainify }}">
 {{ else if .Site.Params.Description }}
   <meta name="descripion" content="{{.Site.Params.Description }}">
-{{ end }}
\ No newline at end of file
+{{ end }}
+{{- partialCached "hooks/head" . }}
\ No newline at end of file
diff --git a/layouts/partials/hooks/head.html b/layouts/partials/hooks/head.html
new file mode 100644
index 0000000..6516af5
--- /dev/null
+++ b/layouts/partials/hooks/head.html
@@ -0,0 +1 @@
+<!-- custom styles, preload scripts, custom meta tags -->
\ No newline at end of file
diff --git a/layouts/partials/hooks/scripts.html b/layouts/partials/hooks/scripts.html
new file mode 100644
index 0000000..27ccab4
--- /dev/null
+++ b/layouts/partials/hooks/scripts.html
@@ -0,0 +1 @@
+<!-- custom scripts -->
\ No newline at end of file
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
index 635b788..e144389 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts.html
@@ -18,3 +18,12 @@
 
 {{- $bundle := slice $variables $functions $code $main $fuse $search | resources.Concat "js/bundle.js" | resources.Minify | resources.Fingerprint "sha512" }}
 <script src="{{ $bundle.Permalink }}"></script>
+
+{{- partialCached "hooks/scripts" . -}}
+
+{{- $sp := .Site.Params }}
+{{- with $sp.customJS }}
+  {{- range . -}}
+    <script src="{{ . }}"></script>
+  {{- end }}
+{{- end -}}

--
Gitblit v1.10.0