From 3af59176f4bfa6512a38acfad897dddbae916ca2 Mon Sep 17 00:00:00 2001
From: Peter Mosses
Date: Thu, 29 Aug 2019 14:40:38 +0200
Subject: [PATCH 01/10] Revert "Update nav.html"
This reverts commit 209ac7be7db196dec85c5d0698189bf1f49a4488.
---
_includes/nav.html | 2 --
1 file changed, 2 deletions(-)
diff --git a/_includes/nav.html b/_includes/nav.html
index fdcf1e1..1c1dd2b 100644
--- a/_includes/nav.html
+++ b/_includes/nav.html
@@ -20,7 +20,6 @@
{%- endif -%}
{{ child.title }}
{%- if child.has_children -%}
- {%- if page.url == child.url or page.parent == child.title -%}
{%- assign grand_children_list = site.html_pages | where: "parent", child.title | sort:"nav_order" -%}
{%- for grand_child in grand_children_list -%}
@@ -30,7 +29,6 @@
{%- endfor -%}
{%- endif -%}
- {%- endif -%}
{%- endfor -%}
From 5e72b7db67a8275f3c64a1a03674d70e6ca0d770 Mon Sep 17 00:00:00 2001
From: Peter Mosses
Date: Thu, 29 Aug 2019 14:41:09 +0200
Subject: [PATCH 02/10] Revert "Revert "Optional delay of grandchildren link
display""
This reverts commit 89f79138c3eecbaee272e60f416095db4944cac0.
---
_config.yml | 3 +++
_includes/nav.html | 2 ++
docs/navigation-structure.md | 14 ++++++++++++++
3 files changed, 19 insertions(+)
diff --git a/_config.yml b/_config.yml
index d12d439..1d5164b 100644
--- a/_config.yml
+++ b/_config.yml
@@ -27,6 +27,9 @@ search_enabled: true
# Enable or disable heading anchors
heading_anchors: true
+# Restrict display of grandchildren to selected parent when true:
+grandchildren_branch: false
+
# Aux links for the upper right navigation
aux_links:
"Just the Docs on GitHub":
diff --git a/_includes/nav.html b/_includes/nav.html
index 1c1dd2b..6ab2dbc 100644
--- a/_includes/nav.html
+++ b/_includes/nav.html
@@ -20,6 +20,7 @@
{%- endif -%}
{{ child.title }}
{%- if child.has_children -%}
+ {%- if page.url == child.url or page.parent == child.title or site.grandchildren_branch != true -%}
{%- assign grand_children_list = site.html_pages | where: "parent", child.title | sort:"nav_order" -%}
{%- for grand_child in grand_children_list -%}
@@ -29,6 +30,7 @@
{%- endfor -%}
{%- endif -%}
+ {%- endif -%}
{%- endfor -%}
diff --git a/docs/navigation-structure.md b/docs/navigation-structure.md
index 98107cf..cce9def 100644
--- a/docs/navigation-structure.md
+++ b/docs/navigation-structure.md
@@ -191,6 +191,20 @@ This would create the following navigation structure:
+-- ..
```
+The current default is that when a grandparent is selected, the links to its
+children *and all its grandchildren* are displayed in the navigation menu.
+So in the above example, selecting `UI Components` displays the link to
+`Button Child Page` as well as the link to `Buttons`.
+
+Setting the following global option in `_config.yml` delays the display of links
+to grandchildren until their parent is selected. So selecting `UI Components`
+displays only the link to `Buttons`, and the link to `Button Child Page` is
+displayed when `Buttons` is selected.
+
+```
+grandchildren_branch: true
+```
+
---
## Auxiliary Navigation
From cfbc7f41df79f7a6a6261e0d20b4e8e81d5ce1a0 Mon Sep 17 00:00:00 2001
From: Peter Mosses
Date: Thu, 29 Aug 2019 14:41:21 +0200
Subject: [PATCH 03/10] Revert "Revert "Update nav.html""
This reverts commit 5d58a663016e07e007775dbd3b1b198548f453b3.
---
_includes/nav.html | 2 --
1 file changed, 2 deletions(-)
diff --git a/_includes/nav.html b/_includes/nav.html
index 6ab2dbc..4305801 100644
--- a/_includes/nav.html
+++ b/_includes/nav.html
@@ -10,7 +10,6 @@
{%- endif -%}
{{ node.title }}
{%- if node.has_children -%}
- {%- if page.url == node.url or page.parent == node.title or page.grand_parent == node.title -%}
{%- assign children_list = site.html_pages | where: "parent", node.title | sort:"nav_order" -%}
{%- for child in children_list -%}
@@ -35,7 +34,6 @@
{%- endfor -%}
{%- endif -%}
- {%- endif -%}
{%- endif -%}
{%- endunless -%}
From 8a1e09ec5a78161372c38187b9a6a49ed5751860 Mon Sep 17 00:00:00 2001
From: Peter Mosses
Date: Thu, 29 Aug 2019 14:42:10 +0200
Subject: [PATCH 04/10] Revert "Update nav.html"
This reverts commit c282e4b0a7b27fc27b6cedc9bb67c992fef89dcf.
---
_includes/nav.html | 2 ++
1 file changed, 2 insertions(+)
diff --git a/_includes/nav.html b/_includes/nav.html
index 4305801..6ab2dbc 100644
--- a/_includes/nav.html
+++ b/_includes/nav.html
@@ -10,6 +10,7 @@
{%- endif -%}
{{ node.title }}
{%- if node.has_children -%}
+ {%- if page.url == node.url or page.parent == node.title or page.grand_parent == node.title -%}
{%- assign children_list = site.html_pages | where: "parent", node.title | sort:"nav_order" -%}
{%- for child in children_list -%}
@@ -34,6 +35,7 @@
{%- endfor -%}
{%- endif -%}
+ {%- endif -%}
{%- endif -%}
{%- endunless -%}
From 5b74b442303bd09bfde84bb621b8b986317dadc2 Mon Sep 17 00:00:00 2001
From: Peter Mosses
Date: Thu, 29 Aug 2019 14:42:23 +0200
Subject: [PATCH 05/10] Revert "Optional delay of grandchildren link display"
This reverts commit 8ac545a5eb5da8e2ebe7dda1a8bffa9d94e88cc2.
---
_config.yml | 3 ---
_includes/nav.html | 2 --
docs/navigation-structure.md | 14 --------------
3 files changed, 19 deletions(-)
diff --git a/_config.yml b/_config.yml
index 1d5164b..d12d439 100644
--- a/_config.yml
+++ b/_config.yml
@@ -27,9 +27,6 @@ search_enabled: true
# Enable or disable heading anchors
heading_anchors: true
-# Restrict display of grandchildren to selected parent when true:
-grandchildren_branch: false
-
# Aux links for the upper right navigation
aux_links:
"Just the Docs on GitHub":
diff --git a/_includes/nav.html b/_includes/nav.html
index 6ab2dbc..1c1dd2b 100644
--- a/_includes/nav.html
+++ b/_includes/nav.html
@@ -20,7 +20,6 @@
{%- endif -%}
{{ child.title }}
{%- if child.has_children -%}
- {%- if page.url == child.url or page.parent == child.title or site.grandchildren_branch != true -%}
{%- assign grand_children_list = site.html_pages | where: "parent", child.title | sort:"nav_order" -%}
{%- for grand_child in grand_children_list -%}
@@ -30,7 +29,6 @@
{%- endfor -%}
{%- endif -%}
- {%- endif -%}
{%- endfor -%}
diff --git a/docs/navigation-structure.md b/docs/navigation-structure.md
index cce9def..98107cf 100644
--- a/docs/navigation-structure.md
+++ b/docs/navigation-structure.md
@@ -191,20 +191,6 @@ This would create the following navigation structure:
+-- ..
```
-The current default is that when a grandparent is selected, the links to its
-children *and all its grandchildren* are displayed in the navigation menu.
-So in the above example, selecting `UI Components` displays the link to
-`Button Child Page` as well as the link to `Buttons`.
-
-Setting the following global option in `_config.yml` delays the display of links
-to grandchildren until their parent is selected. So selecting `UI Components`
-displays only the link to `Buttons`, and the link to `Button Child Page` is
-displayed when `Buttons` is selected.
-
-```
-grandchildren_branch: true
-```
-
---
## Auxiliary Navigation
From 690d0b5e8adc3c4129acc33b1c15c22987f6e871 Mon Sep 17 00:00:00 2001
From: Peter Mosses
Date: Thu, 29 Aug 2019 14:42:47 +0200
Subject: [PATCH 06/10] Revert "Update nav.html"
This reverts commit 0cfc0f0357a3b98997ddafe05f819537ffcd1980.
---
_includes/nav.html | 2 --
1 file changed, 2 deletions(-)
diff --git a/_includes/nav.html b/_includes/nav.html
index 1c1dd2b..d561a42 100644
--- a/_includes/nav.html
+++ b/_includes/nav.html
@@ -10,7 +10,6 @@
{%- endif -%}
{{ node.title }}
{%- if node.has_children -%}
- {%- if page.url == node.url or page.parent == node.title or page.grand_parent == node.title -%}
{%- assign children_list = site.html_pages | where: "parent", node.title | sort:"nav_order" -%}
{%- for child in children_list -%}
@@ -33,7 +32,6 @@
{%- endfor -%}
{%- endif -%}
- {%- endif -%}
{%- endif -%}
{%- endunless -%}
From ed492bf40e5e2d15bc118aa73d6e57e278d013c2 Mon Sep 17 00:00:00 2001
From: Peter Mosses
Date: Thu, 29 Aug 2019 14:45:09 +0200
Subject: [PATCH 07/10] Revert "Update .gitignore"
This reverts commit 13ef18501089e4c7004fadec83990787502a497d.
---
.gitignore | 1 -
1 file changed, 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index 25e8803..b447a12 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,3 @@
_site
Gemfile.lock
node_modules
-.jekyll-metadata
From 50cdf076b4c1859f5677919ccf2006e3ecc65e2e Mon Sep 17 00:00:00 2001
From: Peter Mosses
Date: Thu, 29 Aug 2019 15:36:13 +0200
Subject: [PATCH 08/10] Add configuration option search_tokenizer_separator
The default is for hyphens to separate tokens in search terms: `gem-based` is equivalent to `gem based`.
This adds `search_tokenizer_separator` as a site configuation option, to support search for hyphenated words.
---
_config.yml | 5 +++++
assets/js/just-the-docs.js | 2 +-
docs/search.md | 9 +++++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/_config.yml b/_config.yml
index d12d439..a2e3952 100644
--- a/_config.yml
+++ b/_config.yml
@@ -24,6 +24,11 @@ exclude: ["node_modules/", "*.gemspec", "*.gem", "Gemfile", "Gemfile.lock", "pac
# Enable or disable the site search
search_enabled: true
+# Set the search token separator
+search_tokenizer_separator: /[\s\-/]+/
+# For hyphenated-word search:
+# search_tokenizer_separator: /[\s/]+/
+
# Enable or disable heading anchors
heading_anchors: true
diff --git a/assets/js/just-the-docs.js b/assets/js/just-the-docs.js
index aadbf82..308460e 100644
--- a/assets/js/just-the-docs.js
+++ b/assets/js/just-the-docs.js
@@ -53,7 +53,7 @@ function initSearch() {
// Success!
var data = JSON.parse(request.responseText);
- lunr.tokenizer.separator = /[\s\-/]+/
+ lunr.tokenizer.separator = {{ site.search_tokenizer_separator }}
var index = lunr(function () {
this.ref('id');
this.field('title', { boost: 200 });
diff --git a/docs/search.md b/docs/search.md
index 134e399..74b398f 100644
--- a/docs/search.md
+++ b/docs/search.md
@@ -59,6 +59,15 @@ In your site's `_config.yml`, enable search:
search_enabled: true
```
+The default is for hyphens to separate tokens in search terms:
+`gem-based` is equivalent to `gem based`, matching either word.
+To allow search for hyphenated words:
+
+```yaml
+# Set the search token separator
+search_tokenizer_separator: /[\s/]+/
+```
+
## Hiding pages from search
Sometimes you might have a page that you don't want to be indexed for the search nor to show up in search results, e.g, a 404 page. To exclude a page from search, add the `search_exclude: true` parameter to the page's YAML front matter:
From 1564ca4511c9adf8d8894700c1fbaf326b6b2dd9 Mon Sep 17 00:00:00 2001
From: Peter Mosses
Date: Mon, 9 Sep 2019 21:50:05 +0200
Subject: [PATCH 09/10] Update configuration.md
Added documentation for `search_tokenizer_separator`.
---
docs/configuration.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/docs/configuration.md b/docs/configuration.md
index 14422fd..5e469d2 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -28,6 +28,10 @@ View this site's [_config.yml](https://github.com/pmarsceill/just-the-docs/tree/
# Enable or disable the site search
# Support true (default) or false
search_enabled: true
+
+# Enable support for hyphenated search words:
+search_tokenizer_separator: /[\s/]+/
+
```
## Aux links
From 9616dcf761e947d6dc8939f29ebffe7e59e201f3 Mon Sep 17 00:00:00 2001
From: Patrick Marsceill
Date: Mon, 9 Sep 2019 15:50:48 -0400
Subject: [PATCH 10/10] Update just-the-docs.js
---
assets/js/just-the-docs.js | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/assets/js/just-the-docs.js b/assets/js/just-the-docs.js
index 308460e..0216181 100644
--- a/assets/js/just-the-docs.js
+++ b/assets/js/just-the-docs.js
@@ -52,8 +52,13 @@ function initSearch() {
if (request.status >= 200 && request.status < 400) {
// Success!
var data = JSON.parse(request.responseText);
-
+
+ {% if site.search_tokenizer_separator != nil %}
lunr.tokenizer.separator = {{ site.search_tokenizer_separator }}
+ {% else %}
+ lunr.tokenizer.separator = /[\s\-/]+/
+ {% end %}
+
var index = lunr(function () {
this.ref('id');
this.field('title', { boost: 200 });