From e6fc968cbdd592ed73ed49eb622cbf32ed67728c Mon Sep 17 00:00:00 2001 From: Dean Attali Date: Wed, 18 Sep 2024 05:06:29 +0000 Subject: [PATCH] move search to its own file; fixes 1284 --- _includes/search.html | 26 ++------------------------ assets/data/searchcorpus.json | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 24 deletions(-) create mode 100644 assets/data/searchcorpus.json diff --git a/_includes/search.html b/_includes/search.html index 3a8536c..dc0f87f 100644 --- a/_includes/search.html +++ b/_includes/search.html @@ -8,32 +8,10 @@ diff --git a/assets/data/searchcorpus.json b/assets/data/searchcorpus.json new file mode 100644 index 0000000..9b0aecf --- /dev/null +++ b/assets/data/searchcorpus.json @@ -0,0 +1,23 @@ +--- +layout: null +--- +[ +{% for post in site.posts %} +{ +"title" : "{% if post.title != "" %}{{ post.title | strip_html | escape }}{% else %}{{ post.excerpt | strip_html | escape | strip }}{%endif%}", +"desc" : "{% if post.title != "" %}{{ post.title | strip_html | escape }}{% else %}{{ post.excerpt | strip_html | escape | strip }}{%endif%}", +"category" : "{{ post.tags | join: ', ' }}", +"url" : "{{ site.baseurl }}{{ post.url | escape }}", +"date" : "{{ post.date | date: "%B %e, %Y" | default: "January 1, 1970" }}" +}, +{% endfor %} +{% for page in site.html_pages %}{% if page.title != "{title}" and page.title != "404 - Page not found" %} +{ +"title" : "{% if page.title != "" %}{{ page.title | strip_html | escape }}{% else %}{{ page.excerpt | strip_html | escape | strip }}{% endif %}", +"desc" : "{% if page.title != "" %}{{ page.title | strip_html | escape }}{% else %}{{ page.excerpt | strip_html | escape | strip }}{% endif %}", +"category" : "{% if page.tags %}{{ page.tags | join: ', ' }}{% else %}page{% endif %}", +"url" : "{{ site.baseurl }}{{ page.url }}", +"date" : "{{ page.date | date: '%B %e, %Y' | default: "January 1, 1970" }}" +}{% unless forloop.last %},{% endunless %} +{% endif %}{% endfor %} +]