3 | {# Find lighter navigation. There are three types: #}
4 | {# 1. directly find the lighter if exists, #}
5 | {# 2. find the last page in the previous sibling section, and #}
6 | {# 3. find the last page in the parent section. #}
7 | {% if page.lower %}
8 |
9 |
10 |
11 | ← {{ page.lower.title }}
12 |
13 |
14 |
15 | {% elif not page.extra.top %}
16 | {% set index = get_section(path=page.ancestors | reverse | first) %}
17 | {% set parent = get_section(path=index.ancestors | reverse | first)%}
18 | {% set first_subsection = get_section(path=parent.subsections | first) %}
19 | {% if index == first_subsection %}
20 | {% if parent.pages %}
21 | {% set last_page = parent.pages | last %}
22 |
23 |
24 |
25 | ← {{ last_page.title }}
26 |
27 |
28 |
29 | {% endif %}
30 | {% else %}
31 | {% for s in parent.subsections | reverse %}
32 | {% set subsection = get_section(path=s) %}
33 | {% if subsection.permalink == index.permalink %}
34 | {% set_global found_current = true %}
35 | {% else %}
36 | {% if found_current %}
37 | {% if subsection.pages %}
38 | {% set last_page = subsection.pages | last %}
39 |
40 |
41 |
42 | ← {{ last_page.title }}
43 |
44 |
45 |
46 | {% endif %}
47 | {# no break #}
48 | {% set_global found_current = false %}
49 | {% endif %}
50 | {% endif %}
51 | {% endfor %}
52 | {% endif %}
53 | {% endif %}
54 |
55 | {# Find heavier navigation. There are also three types: #}
56 | {# 1. directly find the heavier if exists, #}
57 | {# 2. find the first page in the subsection, and #}
58 | {# 3. find the first page in the next sibling section. #}
59 | {% if page.higher %}
60 |
61 |
62 |
63 | {{ page.higher.title }} →
64 |
65 |
66 |
67 | {% elif page.extra.top %}
68 | {% set index_path = current_section ~ "/_index.md" | trim_start_matches(pat="/") %}
69 | {% set index = get_section(path=index_path) %}
70 | {% set first_subsection = get_section(path=index.subsections | first) %}
71 | {% if first_subsection.pages %}
72 | {% set first_page = first_subsection.pages | first %}
73 |
74 |
75 |
76 | {{ first_page.title }} →
77 |
78 |
79 |
80 | {% endif %}
81 | {% else %}
82 | {% set index = get_section(path=page.ancestors | reverse | first) %}
83 | {% set parent = get_section(path=index.ancestors | reverse | first)%}
84 | {% for s in parent.subsections %}
85 | {% set subsection = get_section(path=s) %}
86 | {% if subsection.permalink == index.permalink %}
87 | {% set_global found_current = true %}
88 | {% else %}
89 | {% if found_current %}
90 | {% if subsection.pages %}
91 | {% set first_page = subsection.pages | first %}
92 |
93 |
94 |
95 | {{ first_page.title }} →
96 |
97 |
98 |
99 | {% endif %}
100 | {# no break #}
101 | {% set_global found_current = false %}
102 | {% endif %}
103 | {% endif %}
104 | {% endfor %}
105 | {% endif %}
106 |
107 | {% endmacro %}
108 |
--------------------------------------------------------------------------------
/templates/macros/docs-sidebar.html:
--------------------------------------------------------------------------------
1 | {% macro docs_sidebar(current_section) %}
2 |
29 | {% endmacro %}
30 |
--------------------------------------------------------------------------------
/templates/macros/docs-toc.html:
--------------------------------------------------------------------------------
1 | {% macro docs_toc(page) %}
2 | {% if page.extra.toc %}
3 |
3 | {% endmacro %}
4 |
--------------------------------------------------------------------------------
/templates/macros/section-navigation.html:
--------------------------------------------------------------------------------
1 | {% macro navigation(paginator) %}
2 |
3 | {% if paginator.previous %}
4 |
5 |
10 |
11 | {% endif %}
12 | {% if paginator.next %}
13 |
14 |
15 |
16 | Older →
17 |
18 |
19 |
20 | {% endif %}
21 |
22 | {% endmacro %}
23 |
--------------------------------------------------------------------------------
/templates/page.html:
--------------------------------------------------------------------------------
1 | {# Default page.html template #}
2 |
3 | {% extends "base.html" %}
4 |
5 | {% block seo %}
6 | {{ super() }}
7 | {% set title_addition = "" %}
8 | {% if page.title and config.title %}
9 | {% set title = page.title %}
10 | {% set title_addition = title_separator ~ config.title %}
11 | {% elif page.title %}
12 | {% set title = page.title %}
13 | {% else %}
14 | {% set title = config.title %}
15 | {% endif %}
16 |
17 | {% if page.description %}
18 | {% set description = page.description %}
19 | {% else %}
20 | {% set description = config.description %}
21 | {% endif %}
22 | {% set created_time = page.date %}
23 | {% set updated_time = page.updated %}
24 | {% if current_section %}
25 | {% set page_section = current_section %}
26 | {% else %}
27 | {% set page_section = "" %}
28 | {% endif %}
29 |
30 | {{ macros_head::seo(title=title, title_addition=title_addition, description=description, type="article", is_page=true, created_time=created_time, updated_time=updated_time, page_section=page_section) }}
31 | {% endblock seo %}
32 |
33 | {% block body %}
34 | {% if section.extra.class %}
35 | {% set page_class = page.extra.class %}
36 | {% else %}
37 | {% set page_class = "page single" %}
38 | {% endif %}
39 | {% endblock body %}
40 |
41 | {% block content %}
42 |