You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
4.1 KiB
HTML

{% macro list_posts(pages, tag_name=false) %}
<ul>
{% if tag_name %}
<li>{{ term.name }}</li>
{% else %}
<li>blog posts</li>
{% endif -%}
<ul>
{%- for page in pages %}
{%- if page.draft %}
{% continue %}
{% endif -%}
<li >
{{ page.date | date(format="%Y-%m-%d") }} <a href={{ page.permalink }}>{{page.title}}</a>
</li>
{% endfor -%}
</ul>
</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) %}
<h1 >
{{ title }}
</h1>
{% endmacro content %}
{% macro content(page) %}
<main>
{% set words = page.word_count %}
{% set time = page.reading_time %}
{% if time < 1 %}
{% set time = 1 %}
{% endif %}
<article>
<div class="title">
{#<h1 class="title">{{ page.title }}</h1>#}
{{ post_macros::page_header(title=page.title) }}
{% if page.date %}
<div class="meta">
<span class="post_date">{{ page.date | date(format="%Y-%m-%d") }}</span>|
{{ time }} {% if time > 1 %} mins{% else %}min{% endif %}
{% if page.draft %}
|<span class="draft-label">DRAFT</span>
{% endif %}
</div>
{% if page.taxonomies and page.taxonomies.tags %}
<br>
tags:
{% for tag in page.taxonomies.tags %}
<a href={{ get_taxonomy_url(kind='tags', name=tag) | safe }}>
{{ tag }}</a>{% if loop.index != page.taxonomies.tags | length %},{% endif %}
{% endfor %}
{% endif %}
{% 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>
</article>
</main>
{% endmacro content %}