-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathsearch_data.json
54 lines (53 loc) · 2.36 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
44
45
46
47
48
49
50
51
52
53
---
layout: null
---
[
{%- assign sortedPages = site.pages | concat: site.documents | sort:"title" -%}
{%- for page in sortedPages -%}
{%- if page.path contains '_remote/' -%}{%- continue -%}{%- endif -%}
{%- if page.url == "/" -%}
{%- assign docId = "home" -%}
{%- else -%}
{%- assign docId = page.url | slugify -%}
{%- endif -%}
{%- if docId == "search-data-json" -%}{%- continue -%}{%- endif -%}
{%- if docId == "search-endpoints-json" -%}{%- continue -%}{%- endif -%}
{%- if docId == "assets-main-css" -%}{%- continue -%}{%- endif -%}
{%- if docId == "assets-main-css-map" -%}{%- continue -%}{%- endif -%}
{%- if docId == "banner-area-html" -%}{%- continue -%}{%- endif -%}
{%- if docId == "feed-xml" -%}{%- continue -%}{%- endif -%}
{%- if docId == "error-html" -%}{%- continue -%}{%- endif -%}
{%- assign areas = page.url | split:'/' -%}
{%- assign len = areas.size | minus: 2 -%}
{%- capture leader -%}
{%- if page.titleLeader -%}
{{ page.titleLeader | append:' ' }}
{%- else -%}
{% for i in (1..len) %}{{ areas[i] | capitalize }} | {% endfor %}
{%- endif -%}
{%- endcapture -%}
{
"id": "{{ docId }}",
"title": "{{ leader | remove:'Doc |' }}{{ page.title | xml_escape }}",
"content": "{{ page.content | strip_html | escape | remove: '\' | split: ' ' | join: ' ' }}",
"url": "{{ page.url | xml_escape | remove: '.html' }}",
"author": "{{ page.author | xml_escape }}",
"categories": "{%- for category in page.categories -%}{{ category }}{%- unless forloop.last -%}, {%- endunless -%}{%- endfor -%}"
},
{%- endfor -%}
{%- for page in site.remote -%}
{%- assign remoteId = page.path | slugify | remove: '-md' -%}
{%- assign remoteTitle = page.path | remove: '_remote/' -%}
{%- assign remoteRepo = remoteTitle | split: "/" | first -%}
{%- assign remotePath = remoteTitle | split: "/" | slice: 1, 5 | join: '/' -%}
{
"id": "{{ remoteId }}",
"title": "Remote >> {{ remoteTitle }}",
"content": "{{ page.content | strip_html | escape | remove: '\' | split: ' ' | join: ' ' }}",
"url": "https://github.com/folio-org/{{ remoteRepo }}/blob/master/{{ remotePath }}",
"author": "{{ page.author | xml_escape }}",
"categories": ""
}
{%- unless forloop.last -%},{%- endunless -%}
{%- endfor -%}
]