-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.json
49 lines (49 loc) · 1.95 KB
/
index.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
---
template_engine: liquid
---
[
{%- assign looped = false %}
{%- assign documents = site.documents %}
{%- if site.content_engine == "resource" %}{% assign documents = site.resources %}{% endif %}
{%- for document in documents %}
{%- if document.title %}
{%- unless document.exclude_from_search or document.id == "" %}
{%- assign url = document.url %}
{%- if site.content_engine == "resource" %}{% assign url = document.relative_url %}{% endif %}
{%- if looped %},{% endif %}
{
"id": "{{ url | slugify }}",
"title": {{ document.title | jsonify }},
{%- if document.collection %}
"collection": {
"label": {{ document.collection.label | jsonify }},
"name": {{ document.collection.name | default: "Posts" | jsonify }}
},
{%- endif %}
"categories": {{ document.categories | join: ", " | jsonify }},
"tags": {{ document.tags | join: ", " | jsonify }},
"url": {{ url | jsonify }},
"content": {{ document.content | strip_html | replace_regex: "[\s/\n]+"," " | strip | jsonify }}
}
{%- assign looped = true %}
{%- endunless %}
{%- endif %}
{%- endfor %}
{%- for document in site.generated_pages %}
{%- if document.name contains ".md" or document.name contains ".html" %}
{%- if document.title %}
{%- unless document.exclude_from_search %}
{%- if looped %},{% endif %}
{
"id": "{{ document.url | slugify }}",
"title": {{ document.title | jsonify }},
"categories": {{ document.categories | join: ", " | jsonify }},
"tags": {{ document.tags | join: ", " | jsonify }},
"url": {{ document.url | jsonify }},
"content": {{ document.content | strip_html | replace_regex: "[\s/\n]+"," " | strip | jsonify }}
}
{%- endunless %}
{%- endif %}
{%- endif %}
{%- endfor %}
]