Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve search file #418

Merged
merged 6 commits into from
Dec 17, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Compress search
  • Loading branch information
sylhare committed Dec 16, 2023
commit 478d05b34bc3cb218a8c2f9a9dc271f587aea412
33 changes: 6 additions & 27 deletions assets/data/search.liquid
Original file line number Diff line number Diff line change
@@ -1,29 +1,8 @@
---
---
[
{% 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 %}
{% assign emptyField = '{ },' %}
{{ _search | split: " " | join: " " | remove: emptyField }}