diff --git a/_includes/default/search_input.liquid b/_includes/default/search_input.liquid index 44ff7eb3a0..deb35dfe0a 100644 --- a/_includes/default/search_input.liquid +++ b/_includes/default/search_input.liquid @@ -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 %} ]