Skip to content

Commit

Permalink
Merge pull request #421 from sylhare/search-fix
Browse files Browse the repository at this point in the history
Fix no collection search
  • Loading branch information
sylhare authored Dec 18, 2023
2 parents 2c6f6cc + 292509c commit b5c9c17
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions _includes/default/search_input.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,25 @@
{% endunless %}
}{% unless forloop.last %},{% endunless %}
{% endfor %}
{% if site.collections.size > 0 %},{% endif %}
{% if site.collections.size > 1 %},{% endif %}
{% for collection in site.collections %}
{% for page in site[collection.label] %}
{
{% if page.excluded or 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" | default: "N/A" }}",
"excerpt" : {{ page.content | strip_html | strip_newlines | strip | escape | truncate: '250' | jsonify }},
"content" : {{ page.content | strip_html | strip_newlines | strip | escape | jsonify }}
{% endif %}
}{% unless forloop.last %},{% endunless %}
{% endfor %}
{% unless collection.label == 'posts' or site[collection.label].size == 0 %}
{% for page in site[collection.label] %}
{
{% if page.excluded or 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" | default: "N/A" }}",
"excerpt" : {{ page.content | strip_html | strip_newlines | strip | escape | truncate: '250' | jsonify }},
"content" : {{ page.content | strip_html | strip_newlines | strip | escape | jsonify }}
{% endif %}
}{% unless forloop.last %},{% endunless %}
{% endfor %}
{% else %}
{}
{% endunless %}
{% unless forloop.last %},{% endunless %}
{% endfor %}
]

0 comments on commit b5c9c17

Please sign in to comment.