forked from loopbackio/loopback.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
posts.json
49 lines (45 loc) · 2.35 KB
/
posts.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
---
layout: null
---
{
{% for page in site.pages %}
{% if page.layout == 'readme' and page.source %}
{% if page.branch %}
{% assign repo-branch = page.source | append: '/tree/' | append: page.branch %}
{% assign readme-file = page.source | append: '-' | append: page.branch | append: '.md' %}
{% else %}
{% assign repo-branch = page.source %}
{% assign readme-file = page.source | append: '.md' %}
{% endif %}
{% assign readme-loc = page.file | default: 'README.md' %}
{% if page.file %}
{% if page.branch %}
{% assign readme-file = page.source | append: '-' | append: page.branch | append: '/' | append: page.file %}
{% assign repo-branch = page.source | append: '/tree/' | append: page.branch | append: '/' | append: page.file %}
{% else %}
{% assign readme-file = page.source | append: '/' | append: page.file %}
{% assign repo-branch = page.source | append: '/tree/' | append: 'master' | append: '/' | append: page.file %}
{% endif %}
{% endif %}
{% assign path = page.path | split: '/' %}
{% assign size = path.size | minus: 1 %}
{% assign path = path | slice: 0, size | join: '/' %}
{% capture readme %}{% include_relative {{path}}/readmes/{{readme-file}} %}{% endcapture %}
{% else %}
{% assign readme = '' %}
{% endif %}
"{{ page.url | slugify }}": {
"title": "{{ page.title | xml_escape }}",
{% if readme == '' %}
"text": "{{page.content | newline_to_br | strip_newlines | replace: '<br />', ' ' | strip_html | remove: ' ' | remove: '<' | remove: '>' | remove: '&' | remove: '"' | remove: '#' | normalize_whitespace | escape | remove: '\' | remove: '"'}}",
{% else %}
"text": "{{readme | newline_to_br | strip_newlines | replace: '<br />', ' ' | strip_html | remove: ' ' | remove: '<' | remove: '>' | remove: '&' | remove: '"' | remove: '#' | normalize_whitespace | escape | remove: '\' | remove: '"'}}",
{% endif %}
"url": "{{ page.url | xml_escape | strip }}",
"lang": "{{ page.lang }}",
"sidebar": "{{ page.sidebar }}",
"categories": "{% for category in page.categories %}{{ category }}{% unless forloop.last %}, {% endunless %}{% endfor %}"
}
{% unless forloop.last %},{% endunless %}
{% endfor %}
}