cmc/cleberg.net
My personal web garden & blog.
clone: git clone https://gitbay.org/cmc/cleberg.net.git
main: content/templates/base.html · raw
1{# Page layout for the site.
2
3 Styling comes from theme/static/styles.css, published by `[build] assets` in
4 orgo.toml and read in place rather than copied. It is served as authored: at ~1KB,
5 minifying it saved 52 bytes over the wire once compressed, which did not pay for a
6 build step and a toolchain dependency.
7
8 Available here: page (.title .url .source .date .date_iso .tags .excerpt .toc
9 .keywords), site, nav, root, stylesheet. See the orgo guide on Templates. #}
10{#- The table of contents, in the shape Emacs exports it. `page.toc` is a tree of
11 {title, anchor, level, number, children}, and it is empty when the page has no
12 headings or says `#+OPTIONS: toc:nil` — so pages that opt out render nothing here.
13 The number is printed because [html] section_numbers is on; drop it if you turn
14 numbering off, or the contents will number what the headings do not. #}
15{%- macro toc_list(entries) -%}
16<ul>
17{%- for e in entries %}
18<li><a href="#{{ e.anchor }}">{{ e.number }} {{ e.title }}</a>
19{%- if e.children %}{{ toc_list(e.children) }}{% endif %}</li>
20{%- endfor %}
21</ul>
22{%- endmacro %}
23{%- macro toc(entries) -%}
24{%- if entries %}
25<div id="table-of-contents" role="doc-toc">
26<h2>Table of Contents</h2>
27<div id="text-table-of-contents" role="doc-toc">
28{{- toc_list(entries) }}
29</div>
30</div>
31{%- endif %}
32{%- endmacro %}
33<!DOCTYPE html>
34<html lang="{{ site.language }}">
35<head>
36<meta charset="utf-8">
37<title>{% block subtitle %}{{ page.title }} - {% endblock %}{{ site.title }}</title>
38<meta name="viewport" content="width=device-width, initial-scale=1">
39<meta name="author" content="Christian Cleberg <hello@cleberg.net>">
40<meta name="description" content="{% if page.excerpt %}{{ page.excerpt | truncate(150) }}{% else %}{{ site.description }}{% endif %}">
41<meta property="og:title" content="{{ page.title }}">
42<meta property="og:url" content="{{ page.url | absolute | replace("index.html", "") }}">
43<meta property="og:description" content="{% if page.excerpt %}{{ page.excerpt | truncate(150) }}{% else %}{{ site.description }}{% endif %}">
44<link rel="canonical" href="{{ page.url | absolute | replace("index.html", "") }}">
45<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ root }}feed.xml">
46<link rel="stylesheet" href="{{ root }}styles.css" type="text/css">
47<link rel="icon" href="data:,">
48{#- rel="me" identity links, spelled as <link> rather than <a>: a browser hoists a
49 stray <a> out of <head>, while <link> stays where it is put. #}
50<link href="https://github.com/ccleberg" rel="me">
51<link href="https://gitlab.com/ccleberg" rel="me">
52<link href="mailto:hello@cleberg.net" rel="me">
53<link href="https://c.im/@cmc" rel="me">
54{%- if stylesheet %}
55<link rel="stylesheet" href="{{ stylesheet }}">
56{%- endif %}
57</head>
58<body>
59<a href="#main-content" class="skip-link">Skip to content</a>
60
61<nav aria-label="Site Navigation">
62<ul>
63<li><a href="{{ root }}index.html">Home</a></li>
64{%- for item in nav %}
65<li><a href="{{ item.url }}">{{ item.title }}</a></li>
66{%- endfor %}
67</ul>
68</nav>
69
70<main id="main-content">
71{% block main %}
72<article>
73<h1>{{ page.title }}</h1>
74{%- if page.date_iso %}
75<p><time datetime="{{ page.date_iso }}">{{ page.date_iso }}</time>{% if page.excerpt %} · {{ page.excerpt }}{% endif %}</p>
76{%- endif %}
77{%- if page.tags %}
78<p>{% for tag in page.tags %}<a href="{{ root }}tags/{{ tag }}.html">#{{ tag }}</a> {% endfor %}</p>
79{%- endif %}
80{#- Blog posts add a reply footer inside this block; see post.html, which the
81 [[pages]] rule in orgo.toml selects for everything under blog/. #}
82<div>
83{{- toc(page.toc) }}
84{% block content %}{{ body | safe }}{% endblock %}</div>
85</article>
86{% endblock %}
87</main>
88
89<footer>
90<a href="https://github.com/ccleberg/cleberg.net">Source</a> ·
91<a href="{{ root }}feed.xml">RSS</a> ·
92<a href="http://paske4urhs6nttrtlkuwa5cowum3fjkc6yv6kl4ncx3mjxcd77764nqd.onion/">Onion</a> ·
93<a href="{{ root }}tips/index.html">Tips</a> ·
94<a href="https://iheartrss.com/">I ♥ RSS</a>
95<p>[ <a href="https://krz.sh">krz</a> · <a href="https://audit-labs.dev">audit labs</a> ]</p>
96</footer>
97</body>
98</html>