forked from OpenVoxProject/openvox-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.json
More file actions
43 lines (43 loc) · 1.59 KB
/
search.json
File metadata and controls
43 lines (43 loc) · 1.59 KB
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
---
layout: null
permalink: /search.json
---
[
{% assign first = true %}
{% assign home_page = site.pages | where: "url", "/" | first %}
{% if home_page %}
{% assign excerpt = home_page.content | markdownify | strip_html | strip_newlines | replace: " ", " " | strip | truncate: 2400, "" %}
{
"title": {{ home_page.title | default: site.title | strip_html | strip | jsonify }},
"url": {{ home_page.url | relative_url | jsonify }},
"content": {{ excerpt | jsonify }}
}
{% assign first = false %}
{% endif %}
{% assign static_pages = site.pages | sort: "url" %}
{% for page in static_pages %}
{% if page.title and page.url and page.url != "/" and page.url != "/search.json" %}
{% unless first %},{% endunless %}
{% assign excerpt = page.content | markdownify | strip_html | strip_newlines | replace: " ", " " | strip | truncate: 2400, "" %}
{
"title": {{ page.title | strip_html | strip | jsonify }},
"url": {{ page.url | relative_url | jsonify }},
"content": {{ excerpt | jsonify }}
}
{% assign first = false %}
{% endif %}
{% endfor %}
{% assign documents = site.documents | sort: "url" %}
{% for doc in documents %}
{% if doc.output and doc.title and doc.url %}
{% unless first %},{% endunless %}
{% assign excerpt = doc.content | markdownify | strip_html | strip_newlines | replace: " ", " " | strip | truncate: 2400, "" %}
{
"title": {{ doc.title | strip_html | strip | jsonify }},
"url": {{ doc.url | relative_url | jsonify }},
"content": {{ excerpt | jsonify }}
}
{% assign first = false %}
{% endif %}
{% endfor %}
]