~williamvds/website

website/templates/macros.html -rw-r--r-- 1.0 KiB
54454d97williamvds Update CV and PDF 2 months ago
                                                                                
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
{% macro iconlink(icon, text, url, class="") %}
<a class="iconlink {%- if class %} {{class}}{% endif %}" href="{{url}}">
	<span class=iconify data-icon="mdi-{{icon}}"></span>{{text}}
</a>
{% endmacro iconlink %}

{% macro nav(path, class="", title=true) %}
<nav>
	{%- if title %}
		<span class=navname>{{config.title}}</span>
	{%- endif %}
	{%- for l in config.extra.links -%}
		{%- if l.url == path and path == "/" -%}
			{%- continue %}
		{%- endif -%}
		{{ macros::iconlink(
			icon  = l.icon,
			text  = l.name,
			url   = l.url,
			class = class
		) }}
	{%- endfor -%}
</nav>
{% endmacro nav %}

{% macro page_toc(toc) %}
{% if toc %}
<div id=toc>
	<nav>
		<h2>Sections</h2>
		<ul>
			{% for h2 in toc %}
			<li class=h2>
				<a href="{{h2.permalink | safe}}">{{h2.title}}</a>
				{% if h2.children %}
				<ul>
					{% for h3 in h2.children %}
					<li class=h3>
						<a href="{{h3.permalink | safe}}">{{h3.title}}</a>
					</li>
					{% endfor %}
				</ul>
				{% endif %}
			</li>
			{% endfor %}
		</ul>
	</nav>
</div>
{% endif %}
{% endmacro page_toc %}