From 793ea356c37b3c406bc1b3af35f390b3c08302a5 Mon Sep 17 00:00:00 2001
From: EricFromCanada <enk3@outlook.com>
Date: Tue, 15 Jan 2019 20:48:00 -0500
Subject: [PATCH] Use `unless` loop for comma

and mention `search_exclude`
---
 assets/js/search-data.json | 2 +-
 docs/search.md             | 4 ++--
 lib/tasks/search.rake      | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/assets/js/search-data.json b/assets/js/search-data.json
index 12de5221..e78d1860 100644
--- a/assets/js/search-data.json
+++ b/assets/js/search-data.json
@@ -7,6 +7,6 @@
     "content": "{{ page.content | newline_to_br | replace: '<br />', ' ' | replace: '</h1>', ' ' | strip_newlines | markdownify | strip_html | remove: 'Table of contents' | xml_excape | escape | replace: '\', ' ' | replace: '```', '' | replace: '   ', ' ' | replace: '    ', ' ' | remove: '---' | remove: '#####' | remove: '####' | remove: '###' | remove: '##' | strip_newlines }}",
     "url": "{{ page.url | absolute_url | xml_escape }}",
     "relUrl": "{{ page.url | xml_escape }}"
-  }{% if forloop.last %}{% else %},{% endif %}
+  }{% unless forloop.last %},{% endunless %}
   {% endif %}{% endfor %}
 }
diff --git a/docs/search.md b/docs/search.md
index 61822d5a..33a9555d 100644
--- a/docs/search.md
+++ b/docs/search.md
@@ -37,13 +37,13 @@ This command creates the `search-data.json` file that Jekyll uses to create your
 {% raw %}---
 ---
 {
-  {% for page in site.html_pages %}"{{ forloop.index0 }}": {
+  {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": {
     "id": "{{ forloop.index0 }}",
     "title": "{{ page.title | xml_escape }}",
     "content": "{{ page.content | markdownify | strip_html | xml_escape | remove: 'Table of contents' | remove: page.title | strip_newlines | replace: '\', ' '}}",
     "url": "{{ page.url | absolute_url | xml_escape }}",
     "relUrl": "{{ page.url | xml_escape }}"
-  }{% if forloop.last %}{% else %},
+  }{% unless forloop.last %},{% endunless %}
   {% endif %}{% endfor %}
 }{% endraw %}
 ```
diff --git a/lib/tasks/search.rake b/lib/tasks/search.rake
index 02d0b5e4..bcb01db5 100644
--- a/lib/tasks/search.rake
+++ b/lib/tasks/search.rake
@@ -12,13 +12,13 @@ namespace :search do
       f.puts '---
 ---
 {
-  {% for page in site.html_pages %}"{{ forloop.index0 }}": {
+  {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": {
     "id": "{{ forloop.index0 }}",
     "title": "{{ page.title | xml_escape }}",
     "content": "'+content+'",
     "url": "{{ page.url | absolute_url | xml_escape }}",
     "relUrl": "{{ page.url | xml_escape }}"
-  }{% if forloop.last %}{% else %},
+  }{% unless forloop.last %},{% endunless %}
   {% endif %}{% endfor %}
 }'
     end
-- 
GitLab