itsonus-blog/_includes/layouts/post.njk

45 lines
1.4 KiB
Plaintext

---
layout: layouts/base.njk
templateClass: tmpl-post
---
<h1>{{ title }}</h1>
<ul class="post-metadata">
<li><time datetime="{{ page.date | htmlDateString }}">{{ page.date | readableDate }}</time></li>
{%- for tag in tags | filterTagList %}
{%- set tagUrl %}/tags/{{ tag | slugify }}/{% endset %}
<li><a href="{{ tagUrl }}" class="post-tag">#{{ tag }}</a>{%- if not loop.last %} {% endif %}</li>
{%- endfor %}
</ul>
{{ content | safe }}
<hr>
{% set i18nLinks = page.url | locale_links %}
{% if i18nLinks.length %}
<ul>
<li>
{{ "i18n.also" | i18n }}
{%- for link in i18nLinks %}
<a href="{{ link.url }}" lang="{{ link.lang }}" hreflang="{{ link.lang }}">{{ link.label }}</a>
{%- if not loop.last %},{% endif %}
{%- endfor -%}
</li>
</ul>
{% endif %}
{%- if collections.posts %}
{# these filters are locale-aware in 2.0.0-canary.14 #}
{%- set previousPost = collections.posts | getPreviousCollectionItem %}
{%- set nextPost = collections.posts | getNextCollectionItem %}
{%- if nextPost or previousPost %}
<nav class="post-nav">
<ul>
{%- if previousPost %}<li class="previous">{{ "i18n.previous" | i18n }}: <a href="{{ previousPost.url }}">{{ previousPost.data.title }}</a></li>{% endif %}
{%- if nextPost %}<li class="next">{{ "i18n.next" | i18n }}: <a href="{{ nextPost.url }}">{{ nextPost.data.title }}</a></li>{% endif %}
</ul>
</nav>
{%- endif %}
{%- endif %}