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.

172 lines
5.3 KiB
HTML

2 years ago
{% macro list_posts(pages, tag_name=false) %}
<ul>
{%- if current_path =="/" %}
<li>
{% set url = get_url(path="about") %}
<a href={{ url }}>about me</a>
</li>
{% endif -%}
2 years ago
{% if tag_name %}
<li>{{ term.name }}</li>
{% else %}
<li>blog posts</li>
{% endif -%}
<ul>
{%- for page in pages %}
{%- if page.draft %}
{% continue %}
{% endif -%}
{%- if page.permalink is ending_with("/about/") %}
{% continue %}
{% endif -%}
2 years ago
<li >
{{ page.date | date(format="%Y-%m-%d") }} <a href={{ page.permalink }}>{{page.title}}</a>
</li>
{% endfor -%}
{% set pages_len = pages | length %}
{%- if current_path =="/" %}
<li>
<a href="/posts">more posts</a>
</li>
{% endif -%}
2 years ago
</ul>
{%- if current_path =="/" %}
<li>
as soon
</li>
{% endif -%}
2 years ago
</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 page_header %}
2 years ago
{% macro content(page) %}
<main>
{% set words = page.word_count %}
{% set time = page.reading_time %}
{% if time < 1 %}
{% set time = 1 %}
{% endif %}
{% if page.lower %}
{% set_global previous = page.lower %}
{% endif %}
{% if page.higher %}
{% set_global next = page.higher %}
{% endif %}
2 years ago
<article>
<div class="title">
{#<h1 class="title">{{ page.title }}</h1>#}
{{ post_macros::page_header(title=page.title) }}
{% if page.extra and page.extra.no_date %}
{% else %}
2 years ago
{% 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 %}
{% endif %}
2 years ago
</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 previous or next %}
<div class="nav" style="width: 100%;">
2 years ago
{% if next %}
<a href="{{ next.permalink }}">⇦ {{ next.title|truncate(length=16,end="...") }}</a>
{% else %}
<a></a>
{% endif %}
{% if previous%}
<a href="{{ previous.permalink }}">{{ previous.title|truncate(length=16,end="...") }} ⇨</a>
{% else %}
<a></a>
{% endif %}
<span class="stretch"></span>
</div>
{% endif %}
2 years ago
</article>
</main>
{% endmacro content %}