pull/1/head
mat ess 2022-08-13 00:47:49 -04:00
parent 748c01b840
commit 343e20177f
6 changed files with 197 additions and 1 deletions

View File

@ -9,8 +9,13 @@ generate_feed = true
theme = "apollo"
taxonomies = [
{ name = "tags" },
]
[markdown]
highlight_code = true
highlight_theme = "zenburn"
render_emoji = false
external_links_target_blank = true
external_links_no_referrer = true

View File

@ -1,6 +1,9 @@
+++
title = "diy code hosting with gitea and fly.io"
date = "2022-08-08"
date = "2022-08-07"
updated = "2022-08-08"
[taxonomies]
tags = ["git", "gitea", "fly.io"]
+++
## Setting the scene

View File

@ -138,4 +138,22 @@ code {
// Page title width
.page-header {
max-width: 720px;
}
// Tags
ul.tags {
margin: 0.5rem;
li {
margin-right: 0.6rem;
display: inline-block;
a {
margin-left: 0;
}
}
}
.meta.tags {
float: right;
}

View File

@ -0,0 +1,148 @@
{% macro list_posts(pages) %}
<ul>
{%- for page in pages %}
{%- if page.draft %}
{% continue %}
{% endif -%}
<section class="list-item">
<h1 class="title">
<a href={{ page.permalink }}>{{page.title}}</a>
</h1>
<div class="meta tags">
{{ post_macros::tags(page=page, short=false) }}
</div>
<time>{{ page.date | date(format="%Y-%m-%d") }}</time>
<br />
<div class="description">
{% if page.description %}
{{ page.description }}
{% elif page.summary %}
{{ page.summary }}&hellip;
{% else %}
{% set hide_read_more = true %}
{% endif %}
</div>
{% if not hide_read_more %}
<a class="readmore" href={{ page.permalink }}>Read more ⟶</a>
{% endif %}
</section>
{% endfor -%}
</ul>
{% endmacro list_posts %}
{% macro tags(page, short=false) %}
{%- if page.taxonomies and page.taxonomies.tags %}
<span class="post-tags-inline">
{%- if short %}
::
{%- set sep = "," -%}
{% else %}
:: tags:&nbsp;
{%- set sep = "&nbsp;" -%}
{% endif -%}
{%- 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 %}{{ sep | safe }}{% endif -%}
{% endfor -%}
</span>
{% endif -%}
{% endmacro tags %}
{% macro page_header(title) %}
<div class="page-header">
{{ title }}<span class="primary-color" style="font-size: 1.6em">.</span>
</div>
{% endmacro content %}
{% macro content(page) %}
<main>
<article>
<div class="title">
{#<h1 class="title">{{ page.title }}</h1>#}
{{ post_macros::page_header(title=page.title) }}
{% if page.date %}
<div class="meta">
Posted on {{ page.date | date(format="%Y-%m-%d") }}
{% if page.draft %}
<span class="draft-label">DRAFT</span>
{% endif %}
</div>
{% if page.updated %}
<div class="meta">
Updated on {{ page.updated | date(format="%Y-%m-%d") }}
</div>
{% endif %}
<div class="meta">
{{ page.word_count }} words, {{ page.reading_time }} minute read
</div>
{% endif %}
</div>
{% if page.extra.tldr %}
<div class="tldr">
<strong>tl;dr:</strong>
{{ page.extra.tldr }}
</div>
{% endif %}
{# Optional table of contents #}
{% if config.extra.toc | default(value=false) %}
{% if page.toc %}
<h1>Table of Contents</h1>
<ul>
{% for h1 in page.toc %}
<li>
<a href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
{% if h1.children %}
<ul>
{% for h2 in h1.children %}
<li>
<a href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
</li>
{% if h2.children %}
<ul>
{% for h3 in h2.children %}
<li>
<a href="{{ h3.permalink | safe }}">{{ h3.title }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
<section class="body">
{{ page.content | safe }}
</section>
{% if page.taxonomies and page.taxonomies.tags %}
<div class="post-tags">
<span class="meta">Tagged with</span>
<nav class="nav tags">
<ul class="tags">
{% for tag in page.taxonomies.tags %}
<li><a href="{{ get_taxonomy_url(kind='tags', name=tag) | safe }}">{{ tag }}</a></li>
{% endfor %}
{# {{ post_macros::tags(page=page) }} #}
</ul>
</nav>
</div>
{% endif %}
</article>
</main>
{% endmacro content %}

View File

@ -0,0 +1,13 @@
{% extends "base.html" %}
{% 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 %}
</ul>
{% endblock main_content %}

View File

@ -0,0 +1,9 @@
{% 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)}}
{% endblock main_content %}