-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.json
19 lines (19 loc) · 1.18 KB
/
index.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
---
layout: none
---
{% assign all_categories = site.documents | map: "categories" | join: ", " | split : ", " | compact | uniq | sort %}
{% assign all_page_tags = site.pages | map : "tags" | join: ", " | split : ", " | compact | uniq | sort %}
{% assign all_post_tags = site.posts | map : "tags" | join: ", " | split : ", " | compact | uniq | sort %}
{% assign all_tags = all_page_tags | concat: all_post_tags %}
{% assign all_tags = all_page_tags | compact %}
{
"tags": {
{% for tag in all_tags %}{% assign doc_for_tag = site.tags[tag] | map: "url" %}{% for page in site.pages %}{% if page.tags contains tag %}{% assign doc_for_tag = doc_for_tag | push: page.url %}{% endif %}{% endfor %}
{{tag| jsonify}}: {{doc_for_tag | uniq | jsonify}}{% unless forloop.last %},{% endunless %}
{% endfor %}
},
"categories": {
{% for category in all_categories %}{% assign doc_for_cat = site.categories[category] | map: "url" %}{% for page in site.pages %}{% if page.categories contains category %}{% assign doc_for_cat = doc_for_cat | push: page.url %}{% endif %}{% endfor %}
{{category| jsonify}}: {{doc_for_cat | uniq | jsonify}}{% unless forloop.last %},{% endunless %}{% endfor %}
}
}