Start work on search feature with lunr

This commit is contained in:
Alex Shpak
2019-07-15 18:25:21 +02:00
parent b199d72e5f
commit dda0a0eab1
26 changed files with 148 additions and 75 deletions
+11 -3
View File
@@ -1,5 +1,6 @@
<nav>
{{ partial "docs/brand" . }}
{{ partial "docs/search" . }}
{{ partial "docs/inject/menu-before" . }}
{{ if .Site.Params.BookMenuBundle }}
@@ -11,6 +12,13 @@
{{ partial "docs/inject/menu-after" . }}
</nav>
{{ if .Site.Params.BookEnableJS }}
{{ template "jsmenu" . }}
{{ end }}
<!-- 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>