aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--assets/menu-reset.js7
-rw-r--r--exampleSite/config.toml1
-rw-r--r--exampleSite/config.yaml1
-rw-r--r--layouts/partials/docs/menu.html13
5 files changed, 14 insertions, 9 deletions
diff --git a/README.md b/README.md
index 1fa1ce8..6ba9670 100644
--- a/README.md
+++ b/README.md
@@ -167,6 +167,7 @@ disableKinds = ['taxonomy', 'taxonomyTerm']
# (Optional, default true) Enables search function with flexsearch,
# Index is built on fly, therefore it might slowdown your website.
+ # Configuration for indexing can be adjusted in i18n folder per language.
BookSearch = true
# (Optional, default true) Enables comments template on pages
diff --git a/assets/menu-reset.js b/assets/menu-reset.js
new file mode 100644
index 0000000..f3b90c5
--- /dev/null
+++ b/assets/menu-reset.js
@@ -0,0 +1,7 @@
+(function() {
+ var menu = document.querySelector("aside.book-menu nav");
+ addEventListener("beforeunload", function(event) {
+ localStorage.setItem("menu.scrollTop", menu.scrollTop);
+ });
+ menu.scrollTop = localStorage.getItem("menu.scrollTop");
+})();
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index da06bec..7fe97ac 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -70,6 +70,7 @@ enableGitInfo = true
# (Optional, default true) Enables search function with flexsearch,
# Index is built on fly, therefore it might slowdown your website.
+ # Configuration for indexing can be adjusted in i18n folder per language.
BookSearch = true
# (Optional, default true) Enables comments template on pages
diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml
index 0e56f53..889f96b 100644
--- a/exampleSite/config.yaml
+++ b/exampleSite/config.yaml
@@ -68,6 +68,7 @@ params:
# (Optional, default true) Enables search function with flexsearch,
# Index is built on fly, therefore it might slowdown your website.
+ # Configuration for indexing can be adjusted in i18n folder per language.
BookSearch: true
# (Optional, default true) Enables comments template on pages
diff --git a/layouts/partials/docs/menu.html b/layouts/partials/docs/menu.html
index 0db676f..a0d3c45 100644
--- a/layouts/partials/docs/menu.html
+++ b/layouts/partials/docs/menu.html
@@ -13,12 +13,7 @@
</nav>
<!-- Restore menu position as soon as possible to avoid flickering -->
-<script>
-(function() {
- var menu = document.querySelector("aside.book-menu nav");
- addEventListener("beforeunload", function(event) {
- localStorage.setItem("menu.scrollTop", menu.scrollTop);
- });
- menu.scrollTop = localStorage.getItem("menu.scrollTop");
-})();
-</script>
+{{ $script := resources.Get "menu-reset.js" | resources.Minify }}
+{{ with $script.Content }}
+ <script>{{ . | safeJS }}</script>
+{{ end }}