Files
blog_os/blog/templates/macros.html
Philipp Oppermann b5bd0296bd Add icons to posts
2020-12-30 18:14:17 +01:00

87 lines
3.1 KiB
HTML

{% macro post_link(page) %}
<div>
{% set translations = page.translations | filter(attribute="lang", value=lang) -%}
{%- if translations -%}
{%- set post = get_page(path = translations.0.path) -%}
{%- else -%}
{%- set post = page -%}
{%- set not_translated = true -%}
{%- endif -%}
<h2 class="post-title"><a href="{{ post.path | safe }}">{{ post.title }}</a></h2>
<div class="post-summary">
{{ post.summary | safe }}
<a class="read-more" href="{{ post.path | safe }}"><em>read&nbsp;more&nbsp;»</em></a>
{%- if lang and not_translated and lang != config.default_language -%}
<aside class="no-translation">
(This post is not translated yet.)
</aside>
{%- endif -%}
</div>
</div>
{% endmacro post_link %}
{% macro post_link_edition_3(page) %}
<div>
{% set translations = page.translations | filter(attribute="lang", value=lang) -%}
{%- if translations -%}
{%- set post = get_page(path = translations.0.path) -%}
{%- else -%}
{%- set post = page -%}
{%- set not_translated = true -%}
{%- endif -%}
<h3 class="post-list-title"><a href="{{ post.path | safe }}">{{ post.title }}</a></h3>
<span class="post-list-icon">
{%- if post.extra.icon -%}{{post.extra.icon | safe}}{%- endif -%}
</span>
<div class="post-summary">
{{ post.summary | safe }}
<a class="read-more" href="{{ post.path | safe }}"><em>read&nbsp;more&nbsp;»</em></a>
{%- if lang and not_translated and lang != config.default_language -%}
<aside class="no-translation">
(This post is not translated yet.)
</aside>
{%- endif -%}
</div>
</div>
{% endmacro post_link %}
{% macro utterances() %}
<script src="https://utteranc.es/client.js"
data-repo="phil-opp/blog_os"
data-issue-term="url"
data-label="comments"
crossorigin="anonymous"
async>
</script>
{% endmacro utterances %}
{% macro utterances_edition_3() %}
<script src="https://utteranc.es/client.js"
data-repo="phil-opp/blog_os"
data-issue-term="url"
data-label="comments"
crossorigin="anonymous"
theme="preferred-color-scheme"
async>
</script>
{% endmacro utterances_edition_3 %}
{% macro toc(toc) %}
<details id = "toc-inline">
<summary><b>Table of Contents</b></summary>
<ul>
{% for h2 in toc %}<li>
<a href="#{{h2.id | safe}}">{{ h2.title | safe }}</a>
{% if h2.children %}<ul>
{% for h3 in h2.children %}<li>
<a href="#{{h3.id | safe}}">{{ h3.title | safe }}</a>
</li>{% endfor %}
</ul>{% endif %}
</li>{% endfor %}
<li class="toc-comments-link"><a href="#comments">Comments</a></li>
</ul>
</details>
{% endmacro toc %}