From 38f2cdcc0e72fa59cd1f3c1992efedc6c874a502 Mon Sep 17 00:00:00 2001 From: sylhare Date: Wed, 13 Dec 2023 09:08:26 -0500 Subject: [PATCH] Compress search --- assets/data/search.liquid | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/assets/data/search.liquid b/assets/data/search.liquid index a54e2fdd7f..b6e0fcf693 100644 --- a/assets/data/search.liquid +++ b/assets/data/search.liquid @@ -1,29 +1,7 @@ --- --- -[ - {% for post in site.posts %} - { - "title" : "{{ post.title | strip_newlines | escape }}", - "category" : "{{ post.category }}", - "tags" : "{{ post.tags | join: ', ' | prepend: " " }}", - "url" : "{{ post.url | relative_url }}", - "date" : "{{ post.date | date: "%B %-d, %Y" }}", - "excerpt" : {{ post.content | strip_html | truncate: '250' | escape | jsonify }}, - "content" : {{ post.content | strip_html | escape | jsonify }} -} {% unless forloop.last %},{% endunless %} - {% endfor %} - {% if site.portfolio.size > 0 %},{% endif %} - {% for page in site.portfolio %} - { - {% if page.title != nil %} - "title" : "{{ page.title | strip_newlines | escape }}", - "category" : "{{ page.category }}", - "tags" : "{{ page.tags | join: ', ' | prepend: " " }}", - "url" : "{{ page.url | relative_url }}", - "date" : "{{ page.date | date: "%B %-d, %Y" }}", - "excerpt" : {{ page.content | strip_html | truncate: '250' | jsonify }}, - "content" : {{ page.content | strip_html | escape | jsonify }} - {% endif %} -} {% unless forloop.last %},{% endunless %} - {% endfor %} -] +{% comment %} +The json is created in search_input.liquid and included here to be compresed +{% endcomment %} +{% capture _search %}{% include default/search_input.liquid %}{% endcapture %} +{{ _search | split: " " | join: " " }}