Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zwbetz-gh/cupper-hugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzwbetz <zwbetz@gmail.com>2020-06-03 05:14:46 +0300
committerzwbetz <zwbetz@gmail.com>2020-06-03 05:14:46 +0300
commit1ca724981052ff0b3e7ed49a05fc0c6c16ced544 (patch)
tree95320da0ec1f36d8724c352363f2ce3dc43285a7
parentb1b83b6fe6a9a390fdd84b52d803b27d01e68efc (diff)
add param to set dark theme as default
-rw-r--r--assets/js/template-dom-scripts.js (renamed from static/js/dom-scripts.js)4
-rw-r--r--exampleSite/config.yaml1
-rw-r--r--layouts/partials/script.html5
3 files changed, 9 insertions, 1 deletions
diff --git a/static/js/dom-scripts.js b/assets/js/template-dom-scripts.js
index 5128836..a09330d 100644
--- a/static/js/dom-scripts.js
+++ b/assets/js/template-dom-scripts.js
@@ -130,4 +130,8 @@
}
}
});
+
+ {{ if .Site.Params.darkThemeAsDefault }}
+ darkTheme('screen');
+ {{ end }}
}());
diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml
index ae46486..d1e2b2f 100644
--- a/exampleSite/config.yaml
+++ b/exampleSite/config.yaml
@@ -24,6 +24,7 @@ params:
dateFormat: Jan 2, 2006
codePenUser: someUser
katex: true
+ darkThemeAsDefault: false
# A list of custom css files can be provided, which must be placed inside
# 'static/'.
# This is useful to override just specific css classes, instead of copying
diff --git a/layouts/partials/script.html b/layouts/partials/script.html
index f8d831f..95ebeb2 100644
--- a/layouts/partials/script.html
+++ b/layouts/partials/script.html
@@ -1,2 +1,5 @@
<script src="{{ "js/prism.js" | absURL }}"></script>
-<script src="{{ "js/dom-scripts.js" | absURL }}"></script>
+
+{{ $templateDomScripts := resources.Get "js/template-dom-scripts.js" }}
+{{ $domScripts := $templateDomScripts | resources.ExecuteAsTemplate "js/dom-scripts.js" . }}
+<script src="{{ $domScripts.Permalink }}"></script>