content/templates/detour.html

2272f4bf412ab26c57517e9c369f8859cd269bb1
cleberg.net/content/templates/detour.html history · blame · raw

42 lines · 1830 bytes

 1{# The detour series index at /detour/.
 2
 3   Receives every blog post and filters to the ones tagged `detour`, because a
 4   collection selects by directory and these posts live in blog/ with everything else —
 5   they belong in the blog index and the feed like any other post.
 6
 7   Number and name come from the title (`detour #001: Name`). Location and rating come
 8   from `#+LOCATION:` and `#+RATING:`, which the post also states in its own metadata
 9   block; a listing cannot read prose, so the two structured fields are repeated as
10   keywords.
11
12   The rating prints stars and the "N/5" text both. Stars alone would reach a screen
13   reader as a run of unexplained symbols. #}
14{% extends "base.html" %}
15{% block main %}
16<h1>{{ page.title }}</h1>
17<p>Museums, roadside attractions, public art, and local landmarks worth leaving
18the highway for. One post per place.</p>
19
20<h2>Rating scale</h2>
21<dl>
22<dt>★☆☆☆☆ (1/5)</dt><dd>Only if you're already in the parking lot.</dd>
23<dt>★★☆☆☆ (2/5)</dt><dd>Worth a stop if it's on your route.</dd>
24<dt>★★★☆☆ (3/5)</dt><dd>Worth a short detour, under 30 minutes.</dd>
25<dt>★★★★☆ (4/5)</dt><dd>Worth planning an afternoon around.</dd>
26<dt>★★★★★ (5/5)</dt><dd>Worth a dedicated road trip.</dd>
27</dl>
28
29<h2>The list</h2>
30<ul class="detour-list">
31{%- for entry in pages if "detour" in entry.tags %}
32<li>
33<a href="{{ root }}{{ entry.url }}">{{ entry.title }}</a>
34<span class="detour-meta">
35{%- if entry.keywords.location %}{{ entry.keywords.location }}{% endif %}
36{%- if entry.keywords.location and entry.keywords.rating %} · {% endif %}
37{%- if entry.keywords.rating %}{{ "★" * entry.keywords.rating | int }}{{ "☆" * (5 - entry.keywords.rating | int) }} ({{ entry.keywords.rating }}/5){% endif %}
38</span>
39</li>
40{%- endfor %}
41</ul>
42{% endblock %}