Skip to content

Commit

Permalink
Add failsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
sylhare committed Dec 18, 2023
1 parent 5d4d337 commit 292509c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions _includes/default/search_input.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
{% endfor %}
{% if site.collections.size > 1 %},{% endif %}
{% for collection in site.collections %}
{% for page in site[collection.label] %}
{% unless collection.label == 'posts' %}
{% 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 }}",
Expand All @@ -41,8 +41,10 @@
"content" : {{ page.content | strip_html | strip_newlines | strip | escape | jsonify }}
{% endif %}
}{% unless forloop.last %},{% endunless %}
{% endunless %}
{% endfor %}
{% endfor %}
{% else %}
{}
{% endunless %}
{% unless forloop.last %},{% endunless %}
{% endfor %}
]

0 comments on commit 292509c

Please sign in to comment.