-
Notifications
You must be signed in to change notification settings - Fork 1
/
search.json
37 lines (32 loc) · 1.04 KB
/
search.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
title: search
layout: none
search: exclude
---
[
{}
{% for page in site.pages %}
{% unless page.search == "exclude" or page.title == nil %}
{% comment %} this is still kind of brittle, if we have excluded the first page in pages, according to the rule above, then we'll get invalid json {% endcomment %}
{% unless forloop.first == page and site.posts.size < 1 %},{% endunless %}
{
"title": "{{ page.title | escape }}",
"tags": "{{ page.tags }}",
"keywords": "{{page.keywords}}",
"url": "{{ page.url | remove: "/"}}",
"summary": "{{page.summary | strip }}",
"body": "{{ page.content | strip_html | strip_newlines | replace: '\', '\\\\' | replace: '"', '\\"' | replace: ' ', ' '}}"
}
{% endunless %}
{% endfor %}
{% for post in site.posts %}
{% unless forloop.last %},{% endunless %}
{
"title": "{{ post.title | escape }}",
"tags": "{{ post.tags }}",
"keywords": "{{post.keywords}}",
"url": "{{ post.url | remove: "/" }}",
"summary": "{{post.summary | strip }}"
}
{% endfor %}
]