Template and flake changes
continuous-integration/drone/push Build is passing Details

pull/1/head
mat ess 2022-10-21 02:26:16 -04:00
parent 186df67649
commit 3e1b04b31e
10 changed files with 114 additions and 162 deletions

View File

@ -28,7 +28,7 @@
optimize-images
${ifStaging "BASE_URL=https://staging--mat-services.netlify.app"}
zola build --drafts ${ifStaging "--base-url $BASE_URL"}
# ${ifStaging "cp headers/staging public/_headers"}
${ifStaging "cp headers/staging public/_headers"}
# zola's ignored_content setting doesn't work in static/
rm -rf public/image/_favicon.svg
'';

View File

@ -6,20 +6,16 @@
<body>
<div class="content">
{% include "partials/nav.html" %}
{# Post page is the default #}
{% include "partials/nav.html" -%}
{#- Post page is the default #}
<main class="inner">
{% block main_content %}
{%- block main_content -%}
Nothing here?!
{% endblock main_content %}
{%- endblock main_content -%}
</main>
{% block trailing_content %}
{% endblock trailing_content %}
{% include "partials/footer.html" %}
{% block trailing_content -%}
{%- endblock trailing_content %}
{%- include "partials/footer.html" %}
</div>
</body>

View File

@ -1,18 +1,14 @@
{% extends "base.html" %}
{% block main_content %}
{%- block main_content -%}
{{ post_macros::page_header(title="a sadware company")}}
also on
{% for me in config.extra.me_links %}
{%- if loop.last -%}
<span>and </span>
<span>also on
{%- for me in config.extra.me_links -%}
{%- if loop.last -%}
<span>and </span>
{%- endif %}
<a href="{{ me.url | safe }}" target="_blank" rel="me noopener noreferrer">{{ me.name }}</a>
{%- if not loop.last -%},{%- else %}
</span>
{%- endif -%}
<a href="{{ me.url }}" target="_blank" rel="me noopener noreferrer">{{ me.name }}</a>
{%- if not loop.last -%}
<span>, </span>
{%- else -%}
.
{%- endif -%}
{% endfor %}
{% endfor -%}
{% endblock main_content %}

View File

@ -1,149 +1,129 @@
{% macro list_posts(pages) %}
{% macro list_posts(pages) -%}
<ul>
{%- for page in pages %}
{%- if page.draft %}
{% continue %}
{%- continue -%}
{% endif -%}
<li class="post-list-item">
<h2 class="title">
<a href={{ page.permalink }}>{{page.title}}</a>
</h2>
{% if page.description %}
{%- if page.description %}
<div class="description">
{{ page.description }}
</div>
{% elif page.summary %}
{%- elif page.summary %}
<div class="description">
{{ page.summary }}&hellip;
</div>
{% endif %}
{%- endif %}
<div class="meta">
posted on <time>{{ page.date | date(format="%Y-%m-%d") }}</time>
</div>
{{ post_macros::tags(page=page) }}
<br />
{{- post_macros::tags(page=page) -}}
</li>
{% endfor -%}
</ul>
{% endmacro list_posts %}
{% endmacro list_posts -%}
{% macro tags(page) %}
{%- macro tags(page) %}
{%- if page.taxonomies and page.taxonomies.tags %}
<span class="meta post-tags-inline">
<span>tagged with </span>
{%- for tag in page.taxonomies.tags %}
<a class="post-tag" href="{{ get_taxonomy_url(kind='tags', name=tag) | safe }}">#{{ tag }}</a>
{%- if not loop.last %},{% endif -%}
{% endfor -%}
{% endfor %}
</span>
{% endif -%}
{% endmacro tags %}
{% endmacro tags -%}
{% macro page_header(title) %}
<h1 class="page-header">
{{ title }}<span class="primary-color header-dot">.</span>
</h1>
{% endmacro content %}
{%- macro page_header(title) -%}
<h1 class="page-header">{{ title }}<span class="primary-color header-dot">.</span></h1>
{%- endmacro content %}
{% macro content(page) %}
<article>
<div class="title">
{{ post_macros::page_header(title=page.title) }}
{% if page.date %}
{%- if page.date %}
<div class="meta">
Posted on <time>{{ page.date | date(format="%Y-%m-%d") }}</time>
{% if page.draft %}
{%- if page.draft %}
<span class="draft-label">DRAFT</span>
{% endif %}
{% endif -%}
</div>
{% if page.updated %}
<div class="meta">
Updated on <time>{{ page.updated | date(format="%Y-%m-%d") }}</time>
</div>
{% endif %}
{% endif -%}
<div class="meta">
{{ page.word_count }} words, {{ page.reading_time }} minute read
</div>
{% endif %}
{% endif -%}
</div>
{% if page.extra.hero %}
{%- if page.extra.hero %}
<figure>
<img width=1024 height=512 class="hero" alt="{{ page.extra.heroPrompt }} - generated using Stable Diffusion"
src=hero.webp />
<img width=1024 height=512 class="hero" alt="{{ page.extra.heroPrompt }} - generated using Stable Diffusion" src=hero.webp />
<figcaption>
<p><i>{{ page.extra.heroPrompt }}</i> - generated using Stable Diffusion</p>
</figcaption>
</figure>
{% endif %}
{% if page.extra.tldr %}
{% endif -%}
{%- if page.extra.tldr %}
<div class="tldr">
<strong>tl;dr:</strong>
{{ page.extra.tldr }}
</div>
{% endif %}
{% endif -%}
{# Optional table of contents #}
{% if page.extra.toc | default(value=false) %}
{% if page.toc %}
{%- if page.extra.toc | default(value=false) %}
{%- if page.toc -%}
<h2>Table of Contents</h2>
<ul>
{% for h1 in page.toc %}
{%- for h1 in page.toc %}
<li>
<a href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
{% if h1.children %}
{%- if h1.children %}
<ul>
{% for h2 in h1.children %}
{%- for h2 in h1.children %}
<li>
<a href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
</li>
{% if h2.children %}
{%- if h2.children %}
<ul>
{% for h3 in h2.children %}
{%- for h3 in h2.children %}
<li>
<a href="{{ h3.permalink | safe }}">{{ h3.title }}</a>
</li>
{% endfor %}
{% endfor -%}
</ul>
{% endif %}
{% endfor %}
{% endif -%}
{% endfor -%}
</ul>
{% endif %}
{% endif -%}
</li>
{% endfor %}
{% endfor -%}
</ul>
{% endif %}
{% endif %}
{%- endif -%}
{% endif -%}
<section class="body">
{{ page.content | safe }}
{{ page.content | safe -}}
</section>
{% if page.taxonomies and page.taxonomies.tags %}
{%- if page.taxonomies and page.taxonomies.tags %}
<div class="post-tags">
<span class="meta" id="tagged-with-label">this post is tagged with</span>
<nav class="nav tags" aria-labelledby="tagged-with-label">
<ul class="tags">
{% for tag in page.taxonomies.tags %}
{%- for tag in page.taxonomies.tags -%}
<li>
<a href="{{ get_taxonomy_url(kind='tags', name=tag) | safe }}">
#{{ tag }}
</a>
<a href="{{ get_taxonomy_url(kind='tags', name=tag) | safe }}">#{{ tag }}</a>
</li>
{% endfor %}
{% endfor -%}
</ul>
</nav>
</div>
{% endif %}
{% endif -%}
</article>
{% endmacro content %}
{% endmacro content -%}

View File

@ -1,5 +1,4 @@
{% extends "base.html" %}
{% block main_content %}
{{ post_macros::content(page=page)}}
{% endblock main_content %}
{%- block main_content -%}
{{- post_macros::content(page=page) -}}
{%- endblock main_content -%}

View File

@ -1,8 +1,7 @@
<footer>
<div id="site-info">
<p id="powered-by">
powered by <a href="https://getzola.org" target="_blank" rel="noopener noreferral">zola</a> + <a
href="https://github.com/not-matthias/apollo" target="_blank" rel="noopener noreferral">apollo</a>
powered by <a href="https://getzola.org" target="_blank" rel="noopener noreferral">zola</a> + <a href="https://github.com/not-matthias/apollo" target="_blank" rel="noopener noreferral">apollo</a>
and
<a href="https://nixos.org" target="_blank" rel="noopener noreferral">nix</a>.
</p>
@ -13,10 +12,9 @@
<p id="copyright">
&copy; 2022 mat ess.
</p>
<script data-goatcounter="https://stats.mat.services/count" async src="//stats.mat.services/count.js"
crossorigin></script>
<script data-goatcounter="https://stats.mat.services/count" async src="//stats.mat.services/count.js" crossorigin></script>
<noscript>
{% set current_path = current_path | default(value="/") %}
<img id=pixel src="https://stats.mat.services/count?p={{ current_path }}">
{%- set current_path = current_path | default(value="/") %}
<img id=pixel src="https://stats.mat.services/count?p={{ current_path | safe }}">
</noscript>
</footer>

View File

@ -3,74 +3,58 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% set current_path = current_path | default(value="/") %}
{%- set current_path = current_path | default(value="/") -%}
{# Favicon #}
{% if config.extra.favicon %}
{% set favicon_ext = config.extra.favicon | split(pat=".") | last %}
{%- if config.extra.favicon -%}
{%- set favicon_ext = config.extra.favicon | split(pat=".") | last -%}
<link rel="icon" type="image/{{ favicon_ext }}" href="{{ get_url(path=config.extra.favicon, cachebust=true) }}" />
{% endif %}
{% for font in config.extra.fonts %}
{% for style in ["Bold", "BoldItalic", "Italic", "Regular"] %}
{%- endif -%}
{% for font in config.extra.fonts -%}
{% for style in ["Bold", "BoldItalic", "Italic", "Regular"] -%}
{% set font_path = '/font/' ~ font.path ~ '/' ~ font.name ~ '-' ~ style ~ '.woff2' %}
<link rel="preload" href="{{ get_url(path=font_path, trailing_slash=false) }}" as="font" type="font/woff2"
crossorigin>
{% endfor %}
{% endfor %}
<link rel="preload" href="{{ get_url(path=font_path, trailing_slash=false) }}" as="font" type="font/woff2" crossorigin>
{%- endfor %}
{%- endfor %}
<link href="{{ get_url(path='style/fonts.css', cachebust=true) }}" rel="stylesheet preload" as="style" />
{# RSS #}
{% block rss %}
<link rel="alternate" type="application/atom+xml" title="{{ config.title }}"
href="{{ get_url(path='atom.xml', trailing_slash=false) }}">
{% endblock %}
{%- block rss -%}
<link rel="alternate" type="application/atom+xml" title="{{ config.title }}" href="{{ get_url(path='atom.xml', trailing_slash=false) }}">
{%- endblock -%}
{# Theme #}
<link rel="stylesheet preload" as="style" type="text/css"
href="{{ get_url(path='style/theme/light.css', cachebust=true) }}" />
<link rel="stylesheet preload" as="style" type="text/css"
href="{{ get_url(path='style/theme/dark.css', cachebust=true) }}" media="(prefers-color-scheme: dark)" />
<link rel="stylesheet preload" as="style" type="text/css" media="screen"
href="{{ get_url(path='style/main.css', cachebust=true) }}" />
{% if config.extra.stylesheets %}
{% for stylesheet in config.extra.stylesheets %}
<link rel="stylesheet preload" as="style" type="text/css" href="{{ get_url(path='style/theme/light.css', cachebust=true) }}" />
<link rel="stylesheet preload" as="style" type="text/css" href="{{ get_url(path='style/theme/dark.css', cachebust=true) }}" media="(prefers-color-scheme: dark)" />
<link rel="stylesheet preload" as="style" type="text/css" media="screen" href="{{ get_url(path='style/main.css', cachebust=true) }}" />
{%- if config.extra.stylesheets -%}
{%- for stylesheet in config.extra.stylesheets -%}
<link rel="stylesheet" href="{{ get_url(path=stylesheet, cachebust=true) }}">
{% endfor %}
{% endif %}
{% if current_path == "/" %}
{% set current_title = config.title | default(value="home") %}
{% set current_description = "the personal site of mat ess" %}
{% set hero = false %}
{% else %}
{% set current_title = page.title | default(value=config.title) | default(value="post") %}
{% set current_description = page.description | default(value="from the personal site of mat ess") %}
{% set hero = page.extra.hero | default(value=false) %}
{% endif %}
{%- endfor -%}
{%- endif -%}
{%- if current_path == "/" -%}
{%- set current_title = config.title | default(value="home") -%}
{%- set current_description = "the personal site of mat ess" -%}
{%- set hero = false -%}
{%- else -%}
{%- set current_title = page.title | default(value=config.title) | default(value="post") -%}
{%- set current_description = page.description | default(value="from the personal site of mat ess") -%}
{%- set hero = page.extra.hero | default(value=false) -%}
{%- endif -%}
{# Meta links #}
<title>{{ current_title }}</title>
<link rel="canonical" href="{{ get_url(path=current_path) }}" />
<meta name="title" content="{{ current_title }}">
<meta name="description" content="{{ current_description }}">
{# Open Graph / Facebook #}
{#- Open Graph / Facebook #}
<meta property="og:type" content="website">
<meta property="og:title" content="{{ current_title }}">
<meta property="og:description" content="{{ current_description }}">
{% if hero %}
{%- if hero -%}
<meta property="og:image" content="{{ get_url(path=current_path) }}/hero.webp">
{% endif %}
{# Twitter #}
{%- endif -%}
{#- Twitter #}
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:title" content="{{ current_title }}">
<meta property="twitter:description" content="{{ current_description }}">
{% if hero %}
{%- if hero -%}
<meta property="twitter:image" content="{{ get_url(path=current_path) }}/hero.webp">
{% endif %}
{%- endif %}
</head>

View File

@ -1,11 +1,12 @@
<header>
<div class="main brand">
<a href={{ config.base_url }}><img id="logo" src="{{ get_url(path=config.extra.favicon, cachebust=true) }}"
alt="" />{{ config.title }}</a>
<a href={{ config.base_url | safe }}>
<img id="logo" src="{{ get_url(path=config.extra.favicon, cachebust=true) }}" alt="circular logo" />
{{ config.title }}
</a>
</div>
<nav aria-label="Site navigation">
{% for menu in config.extra.menu %}
{%- for menu in config.extra.menu %}
{%- set external = menu.external | default(value=false) -%}
{%- if external %}
<a href={{ menu.url }} target="_blank" rel="me noopener noreferrer">{{ menu.name }}</a>

View File

@ -3,11 +3,10 @@
{% block main_content %}
{{ post_macros::page_header(title=taxonomy.name) }}
<p>go to <a href="{{ get_url(path='@/posts/_index.md') }}">all posts</a>.</p>
<ul>
{% for term in terms %}
{%- set pages = term.pages | length -%}
<li><a class="tag-link" href="{{ term.permalink }}">{{ term.name }} ({{ pages }} page{{ pages | pluralize }})</a></li>
{% endfor %}
<li><a class="tag-link" href="{{ term.permalink | safe }}">{{ term.name }} ({{ pages }} page{{ pages | pluralize }})</a></li>
{% endfor -%}
</ul>
{% endblock main_content %}

View File

@ -1,9 +1,8 @@
{% extends "base.html" %}
{% block main_content %}
{{ post_macros::page_header(title="posts tagged with " ~ term.name)}}
{%- set parent = get_taxonomy(kind=taxonomy.name) -%}
<p>go to <a href="{{ parent.permalink }}">all tags</a>.</p>
{{ post_macros::list_posts(pages=term.pages)}}
{{ post_macros::page_header(title="posts tagged with " ~ term.name) }}
{%- set parent = get_taxonomy(kind=taxonomy.name) %}
<p>go to <a href="{{ parent.permalink | safe }}">all tags</a>.</p>
{{ post_macros::list_posts(pages=term.pages) -}}
{% endblock main_content %}