forked from mmistakes/so-simple-theme
-
Notifications
You must be signed in to change notification settings - Fork 1
/
search-data.json
43 lines (42 loc) · 1.33 KB
/
search-data.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
---
layout: null
sitemap: false
---
var store = [
{%- for c in site.collections -%}
{%- if forloop.last -%}
{%- assign l = true -%}
{%- endif -%}
{%- assign docs = c.docs | where_exp: 'doc', 'doc.search != false' -%}
{%- for doc in docs -%}
{
"title": {{ doc.title | jsonify }},
"excerpt":
{%- if site.search_full_content == true -%}
{{ doc.content |
replace:"</p>", " " |
replace:"</h1>", " " |
replace:"</h2>", " " |
replace:"</h3>", " " |
replace:"</h4>", " " |
replace:"</h5>", " " |
replace:"</h6>", " "|
strip_html | strip_newlines | jsonify }},
{%- else -%}
{{ doc.content |
replace:"</p>", " " |
replace:"</h1>", " " |
replace:"</h2>", " " |
replace:"</h3>", " " |
replace:"</h4>", " " |
replace:"</h5>", " " |
replace:"</h6>", " "|
strip_html | strip_newlines | truncatewords: 50 | jsonify }},
{%- endif -%}
"categories": {{ doc.categories | jsonify }},
"tags": {{ doc.tags | jsonify }},
"url": {{ doc.url | absolute_url | jsonify }}
} {%- unless forloop.last and l -%}, {%- endunless -%}
{%- endfor -%}
{%- endfor -%}
]