A pile of code changes

This commit is contained in:
lf- 2021-03-09 03:41:36 -08:00
parent 33de49464e
commit a1bdad57dd
39 changed files with 639 additions and 78 deletions

42
templates/base.html Normal file
View file

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{{ config.description }}">
<title>
{{ config.title }}
</title>
<link type="text/css" rel="stylesheet" href="{{ get_url(path="css/normalize.css", cachebust=true) | safe }}">
<link type="text/css" rel="stylesheet" href="{{ get_url(path="/main.css", cachebust=true) | safe }}">
</head>
<body>
<header>
{# linear row of page links #}
<nav class="main-nav">
<ul>
<li>
<a href="/">{{ config.title }}</a>
</li>{#
#}<li>
<a href="/about">About</a>
</li>{#
#}<li>
<a href="https://github.com/lf-">GitHub</a>
</li>
</ul>
</nav>
</header>
<main role="main">
{% block content %}
<h1 style="color: #f00">You should not see this.</h1>
{% endblock content %}
</main>
<footer>
<p>{{ config.extra.copyright }}</p>
</footer>
</body>
</html>

View file

@ -1,47 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% extends "base.html" %}
<title>
{{ config.title }}
</title>
{% block content %}
{% for page in section.pages %}
{% if page.extra.isPage %}
{% continue %}
{% endif %}
<article class="homepage-article">
<a class="homepage-link" href="{{ page.permalink }}"><h2>{{ page.title }}</h2></a>
<div class="detail">
<span>{{ page.date | date(format=config.extra.dtformat) }}</span>
<span>{{ page.reading_time }} minute read</span>
</div>
</article>
{% endfor %}
<link type="text/css" rel="stylesheet" href="{{ get_url(path="/main.css", cachebust=true) | safe }}">
</head>
<body>
<header>
{# linear row of page links #}
<nav class="main-nav">
<ul role="navigation">
<li>
<a href="/">{{ config.title }}</a>
</li>{#
#}<li>
<a href="/about">About</a>
</li>{#
#}<li>
<a href="https://github.com/lf-">GitHub</a>
</li>
</ul>
</nav>
</header>
<main role="main">
{% for page in section.pages %}
<article>
<a href="{{ page.permalink }}"><h2>{{ page.title }}</h2></a>
<div class="detail">
<span>{{ page.date | date(format=config.extra.dtformat) }}</span>
<span>{{ page.reading_time }} minute read</span>
</div>
</article>
{% endfor %}
<pre><code>{{ __tera_context | escape | safe }}</code></pre>
</main>
<footer>
<p>{{ config.extra.copyright }}</p>
</footer>
</body>
</html>
{% if config.extra.debug %}
<pre><code>{{ __tera_context | escape | safe }}</code></pre>
{% endif %}
{% endblock content %}

49
templates/page.html Normal file
View file

@ -0,0 +1,49 @@
{% extends "base.html" %}
{% block content %}
<header class="page-header">
<h1>{{ page.title }}</h1>
{% if not page.extra.isPage %}
<div class="detail page-detail">
<span>{{ page.date | date(format=config.extra.dtformat) }}</span>
<span>{{ page.reading_time }} minute read</span>
</div>
{% endif %}
</header>
{{ page.content | safe }}
{% if config.extra.debug %}
<pre><code>{{ __tera_context | escape | safe }}</code></pre>
{% endif %}
{# back/forward buttons #}
{% if not page.extra.isPage %}
<nav class="article-nav">
<ul>
<li>
<div id="newer-post" class="nav-label">Newer post</div>
{% if page.later %}
<a href="{{ page.later.permalink }}"
aria-labelledby="newer-post">← {{ page.later.title }}</a>
{% else %}
<span class="disabled-link"></span>
{% endif %}
</li>{#
#}<li class="older">
<div id="older-post" class="nav-label">Older post</div>
{% if page.earlier %}
<a href="{{ page.earlier.permalink }}"
aria-labelledby="older-post">{{ page.earlier.title }} →</a>
{% else %}
<span class="disabled-link"></span>
{% endif %}
</li>
</ul>
</nav>
{% endif %}
{% endblock content %}

View file

@ -0,0 +1,20 @@
{% set name_sanitized = name | replace(from=".", to="-") | replace(from="/", to="-") %}
{% set image_id = "image" ~ name_sanitized %}
{% set alt = alt | default(value=body) %}
{% set height = height | default(value=600) %}
<div class="image">
<a href="{{ get_url(path="images/" ~ name) }}">
<img src="{{ resize_image(path="../static/images/" ~ name, width=800, height=height, op="fit") }}"
alt="{{ alt }}"
title="{{ alt }}"
{% if label %}
aria-describedby="{{ image_id }}"
{% endif %}
>
</a>
{% if label %}
<span class="image-label" id="{{ image_id }}">
{{ label }}
</span>
{% endif %}
</div>