aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
Diffstat (limited to 'layouts')
-rw-r--r--layouts/home.json10
-rw-r--r--layouts/partials/docs/html-head.html7
-rw-r--r--layouts/partials/docs/search.html11
3 files changed, 14 insertions, 14 deletions
diff --git a/layouts/home.json b/layouts/home.json
deleted file mode 100644
index f090548..0000000
--- a/layouts/home.json
+++ /dev/null
@@ -1,10 +0,0 @@
-window.lunrData = [
-{{ range $index, $page := .Site.Pages }}
- {{- if and $index (gt $index 0) -}},{{- end }}
- {
- "href": "{{ $page.RelPermalink }}",
- "title": "{{ htmlEscape $page.Title }}",
- "content": {{ $page.Plain | jsonify }}
- }
-{{- end -}}
-]
diff --git a/layouts/partials/docs/html-head.html b/layouts/partials/docs/html-head.html
index 805c2b5..68b29bb 100644
--- a/layouts/partials/docs/html-head.html
+++ b/layouts/partials/docs/html-head.html
@@ -6,8 +6,11 @@
{{- $styles := resources.Get "book.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }}
<link rel="stylesheet" href="{{ $styles.RelPermalink }}">
-{{- $search := resources.Get "search.js" | resources.ExecuteAsTemplate "search.js" . | resources.Minify | resources.Fingerprint }}
-<script src="{{ $search.RelPermalink }}"></script>
+{{ if default true .Site.Params.BookSearch }}
+{{- $searchJS := resources.Get "search.js" | resources.ExecuteAsTemplate "search.js" . | resources.Minify | resources.Fingerprint }}
+<script defer src="{{ "lunr.min.js" | relURL }}"></script>
+<script defer src="{{ $searchJS.RelPermalink }}"></script>
+{{ end }}
<!-- Favicon -->
<link rel="icon" href="{{ "favicon.png" | relURL }}" type="image/x-icon">
diff --git a/layouts/partials/docs/search.html b/layouts/partials/docs/search.html
index d4b0e65..6276cc3 100644
--- a/layouts/partials/docs/search.html
+++ b/layouts/partials/docs/search.html
@@ -1,2 +1,9 @@
-<input type="text" placeholder="Search" class="book-search" id="book-search" />
-<ul id="book-search-results"></ul>
+{{ if default true .Site.Params.BookSearch }}
+<div class="book-search">
+ <ul id="book-search-dummy" class="hidden">
+ <li><a href></a></li>
+ </ul>
+ <input type="text" placeholder="Search" id="book-search-input" />
+ <ul id="book-search-results"></ul>
+</div>
+{{ end }}