forked from TheThingsNetwork/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtree.html
More file actions
57 lines (50 loc) · 2.93 KB
/
tree.html
File metadata and controls
57 lines (50 loc) · 2.93 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{% if include.parent.url | contains:'/index.html' %}
{% assign parent_dir = include.parent.url | remove:'index.html' %}
{% assign page_dir = page.url | split:'/' | reverse | slice:1,100 | reverse | join:'/' | append:'/' %}
{% assign just_believe = page_dir | split:parent_dir | first %}
{% if just_believe != page_dir %}
{% assign parent_depth = include.parent.url | remove:'/index.html' | split:'/' | size %}
{% assign children_depth = parent_depth | plus:1 %}
{% assign pages_filtered = '' | split: '|' %}
{% for apage in include.pages %}
{% if include.section and apage.section != include.section %}
{% continue %}
{% endif %}
{% if include.nosection and apage.section %}
{% continue %}
{% endif %}
{% assign apage_depth = apage.url | remove:'/index.html' | split:'/' | size %}
{% if apage_depth != children_depth %}
{% continue %}
{% endif %}
{% if apage.hidden %}
{% if apage.url contains "index.html" %}
{% assign apage_dir = apage.url | split:'/' | reverse | slice:1,100 | reverse | join:'/' | append:'/' %}
{% assign just_believe = page_dir | split:apage_dir | first %}
{% if just_believe == page_dir %}
{% continue %}
{% endif %}
{% elsif apage.url != page.url %}
{% continue %}
{% endif %}
{% endif %}
{% assign apage_parent_url = apage.url | split:'/' | slice:0,parent_depth | join:'/' | append:'/index.html' %}
{% if apage_parent_url == include.parent.url %}
{% assign pages_filtered = pages_filtered | push: apage %}
{% endif %}
{% endfor %}
{% if pages_filtered.size > 0 %}
{% if include.section %}<li class="page-side-nav-section"><span>{{ include.section }}</span>{% endif %}
<ul>
{% for apage in pages_filtered %}
<li class="{% if apage.url == page.url %}active{% endif %}"><a href="{% if apage.redirect_to %}{% if apage.redirect_to contains ':' %}{{ apage.redirect_to }}{% else %}{{ apage.url | dirname | prepend:site.baseurl}}/{{ apage.redirect_to | remove:'index.html' }}{% endif %}{% else %}{{ apage.url | prepend:site.baseurl | remove:'index.html' }}{% endif %}">{{ apage.title }}</a>
{% unless link.href contains ':' %}{% if apage.redirect_to %}<i class="fa fa-link"></i>{% endif %}{% endunless %}
{% if apage.label %}<span class="label label-info">{{ apage.label }}</span>{% endif %}
{% include tree.html pages=include.pages parent=apage %}
</li>
{% endfor %}
</ul>
{% if include.section %}</li>{% endif %}
{% endif %}
{% endif %}
{% endif %}