blob: 23b5dbf29e72c3e22e24d31f967a2ba0fd3df0cc (
plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
{# misc macros #}
{% macro nav_item(name, url) %}
{% if page %}
{% set curr_url = get_url(path=page.path) %}
{% elif section %}
{% set curr_url = get_url(path=section.path) %}
{% endif %}
{% set url = url | trim_end_matches(pat="/") %}
{% if curr_url %}
<a {% if curr_url == url %}class="active"{% endif %} href={{ url }}>{{ name }}</a>
{% endif %}
{% endmacro nav %}
{% macro toc_item(item, depth=0) %}
<li>
<a href="{{ item.permalink | safe }}">{{ item.title }}</a>
{% if depth < 6 and item.children %}
<ul>
{% for child in item.children %}{{ self::toc_item(item=child, depth=depth + 1) }}{% endfor %}
</ul>
{% endif %}
</li>
{% endmacro %}
{% macro toc(toc) %}
{%- set len = toc | length -%}
{% if len > 1 %}
<nav>
<ul>
{% for child in toc %}{{ self::toc_item(item=child) }}{% endfor %}
</ul>
</nav>
{% endif %}
{% endmacro %}
{% macro header(item, full=false) %}
<header>
<hgroup>
<h1>
{% if full or not item.permalink %}
{{ item.title }}
{% elif item.extra.external %}
<a href="{{ item.extra.external }}">{{ item.title }}</a>
{% else %}
<a href="{{ item.permalink }}">{{ item.title }}</a>
{% endif %}
</h1>
<p>{{ item.description }}</p>
</hgroup>
{% if item.taxonomies["tags"] %}
<nav>
{% for tag in item.taxonomies["tags"] %}
<a href={{ get_taxonomy_url(kind="tags", name=tag) }}>#{{ tag }}</a>
{% endfor %}
</nav>
{% endif %}
</header>
{% if item.date or item.authors %}
<footer>
<p>
Posted
{% if item.date %}
on
<time pubdate datetime="{{ item.date | date(format="%Y-%m-%d") }}">
{{ item.date | date(format="%d %b %Y") }}
</time>
{% endif %}
{% if item.authors %}
<address class="author">
by
{% for author in item.authors -%}
{% if author == config.extra.author %}
<a rel="author" href="{{ config.base_url }}">{{ author }}</a>,
{% elif item.extra[author] %}
<a rel="author" href="{{ item.extra[author] }}">{{ author }}</a>,
{% else %}
{{ author }}
{% endif %}
{% endfor %}
</address>
{% endif %}
</p>
</footer>
{% endif %}
{% if full and item.toc %}
{{ macros::toc(toc=item.toc) }}
{% elif item.summary %}
<p>{{ item.summary | safe }} ...</p>
{% endif %}
{% endmacro %}
|