-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.json
More file actions
35 lines (35 loc) · 1.71 KB
/
search.json
File metadata and controls
35 lines (35 loc) · 1.71 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
---
layout: none
---
{% capture newline %}
{% endcapture %}
{% assign all-contents = '' %}
{% assign all-contents = all-contents | append: '[' %}
{% for page in site.pages %}
{% assign exclision-url = '/tags/' | split: ',' %}
{% assign extension = page.url | slice: -1,1 %}
{% if page.search == false or extension != '/' or exclision-url contains page.url %}
{% continue %}
{% endif %}
{% assign all-contents = all-contents | append: '{' %}
{% assign title = page.title | escape %}
{% assign all-contents = all-contents | append: '"title": "' | append: title | append: '",' %}
{% assign sub-title = page.sub-title | escape %}
{% assign all-contents = all-contents | append: '"subtitle": "' | append: sub-title | append: '",' %}
{% assign all-contents = all-contents | append: '"tags" :[' %}
{% for tag in page.tags%}
{% assign all-contents = all-contents | append: '"' | append: tag | append: '"' %}
{% unless forloop.last %}
{% assign all-contents = all-contents | append: ',' %}
{% endunless %}
{% endfor %}
{% assign all-contents = all-contents | append: '],' %}
{% assign all-contents = all-contents | append: '"url": "' | append: page.url | append: '",' %}
{% assign content = page.content | strip_html | replace: newline, " " | escape %}
{% assign all-contents = all-contents | append: '"content": "' | append: content %}
{% assign all-contents = all-contents | append: '"},' %}
{% endfor %}
{% assign all-contents = all-contents | append: ']' %}
{% assign contents-size = all-contents | size | minus: 2 %}
{% assign all-contents = all-contents | slice: 0,contents-size | append: ']' %}
{{ all-contents }}