diff options
-rw-r--r-- | exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.content | 2 | ||||
-rw-r--r-- | layouts/partials/docs/menu-filetree.html | 15 |
2 files changed, 9 insertions, 8 deletions
diff --git a/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.content b/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.content index dd0105b..a7efdf0 100644 --- a/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.content +++ b/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.content @@ -1,4 +1,4 @@ -(function(){const input=document.querySelector("#book-search-input");const results=document.querySelector("#book-search-results");input.addEventListener("focus",init);input.addEventListener("keyup",search);function init(){input.removeEventListener("focus",init);input.required=true;loadScript("/example/lunr.min.js");loadScript("/example/search-data.min.8e65fc357463e492a0a63bbf1f8879c1d3e651b9b8ab524fd1782b843af7bf9c.js",function(){input.readOnly=false;input.required=false;search();});} +(function(){const input=document.querySelector("#book-search-input");const results=document.querySelector("#book-search-results");input.addEventListener("focus",init);input.addEventListener("keyup",search);function init(){input.removeEventListener("focus",init);input.required=true;loadScript("/lunr.min.js");loadScript("/search-data.min.38819dbbe5e0b55e3b3be88010ec38428c444528b9f100d7b8aa08233677658b.js",function(){input.readOnly=false;input.required=false;search();});} function search(){while(results.firstChild){results.removeChild(results.firstChild);} if(!input.value){return;} const terms=lunr.tokenizer(input.value);const searchHits=window.bookSearch.idx.query(function(query){query.term(terms,{boost:100});query.term(terms,{boost:10,wildcard:lunr.Query.wildcard.LEADING|lunr.Query.wildcard.TRAILING});query.term(terms,{editDistance:2});});searchHits.slice(0,10).forEach(function(hit){const page=window.bookSearch.pages[hit.ref];const li=document.createElement("li"),a=li.appendChild(document.createElement("a"));a.href=page.href;a.textContent=page.title;results.appendChild(li);});} diff --git a/layouts/partials/docs/menu-filetree.html b/layouts/partials/docs/menu-filetree.html index abc6fd9..c8dd86b 100644 --- a/layouts/partials/docs/menu-filetree.html +++ b/layouts/partials/docs/menu-filetree.html @@ -38,13 +38,14 @@ {{ define "book-section-children" }} {{ with .Section }} <ul> - {{ range where .Sections "Params.bookhidden" "!=" true }} - {{ template "book-section" (dict "Section" . "CurrentPage" $.CurrentPage) }} - {{ end }} - {{ range where .Pages "Params.bookhidden" "!=" true }} - <li> - {{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }} - </li> + {{ range where .Pages "Params.bookhidden" "!=" "true" }} + {{ if eq .Kind "section" }} + {{ template "book-section" (dict "Section" . "CurrentPage" $.CurrentPage) }} + {{ else if and (eq .Kind "page") .Content }} + <li> + {{- template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) -}} + </li> + {{ end }} {{ end }} </ul> {{ end }} |