-
Notifications
You must be signed in to change notification settings - Fork 56
/
search.json
51 lines (49 loc) · 2.1 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
layout: null
---
[
{% assign counter = 0 %}
{%- for post in site.posts -%}
{%- if post.title != nil -%}{% assign counter = counter | plus:1 %}
"title" : "{{ post.title | escape }}",
"category" : "{{ post.category }}",
"tags" : "{{ post.tags | join: ', ' }}",
"url" : "{{ post.url | absolute_url }}",
"date" : "{{ post.date }}",
"excerpt" : {{ post.excerpt | strip_html | replace: "\n", " " | jsonify }},
"content" : {{ post.content | strip_html | replace: "\n", " " | jsonify }}
} {% unless forloop.last %},{% endunless %}
{%- endif -%}
{%- endfor -%}
{%- if counter > 0 -%},{% assign counter = 0 %}{%- endif -%}
{%- for page in site.pages -%}
{%- if page.title != nil -%}{% assign counter = counter | plus:1 %}
{
"title" : "{{ page.title | escape }}",
"category" : "{{ page.category }}",
"tags" : "{{ page.tags | join: ', ' }}",
"url" : "{{ page.url | absolute_url }}",
"date" : "{{ page.date }}",
"excerpt" : {{ page.excerpt | strip_html | replace: "\n", " " | jsonify }},
"content" : {{ page.content | strip_html | replace: "\n", " " | jsonify }}
}{% unless forloop.last %},{% endunless %}
{%- endif -%}
{%- endfor -%}
{%- if counter > 0 -%},{% assign counter = 0 %}{%- endif -%}
{%- for collection in site.collections -%}
{%- if collection.docs.size > 0 -%}
{%- for page in collection.docs -%}{% assign counter = counter | plus:1 %}
{
"title" : "{{ page.title | escape }}",
"category" : "{{ collection.title }}",
"tags" : "{{ page.tags | join: ', ' }}",
"url" : "{{ page.url | absolute_url }}",
"date" : "{{ page.date }}",
"excerpt" : {{ page.excerpt | strip_html | replace: "\n", " " | jsonify }},
"content" : {{ page.content | strip_html | replace: "\n", " " | jsonify }}
}{% unless forloop.last %},{% endunless %}
{%- endfor -%}
{%- endif -%}
{% unless forloop.last %}{%- if counter > 0 -%},{% assign counter = 0 %}{%- endif -%}{% endunless %}
{%- endfor -%}
]