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 optimize-images
${ifStaging "BASE_URL=https://staging--mat-services.netlify.app"} ${ifStaging "BASE_URL=https://staging--mat-services.netlify.app"}
zola build --drafts ${ifStaging "--base-url $BASE_URL"} 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/ # zola's ignored_content setting doesn't work in static/
rm -rf public/image/_favicon.svg rm -rf public/image/_favicon.svg
''; '';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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