feat: date formatting

This commit is contained in:
zaaarf 2023-12-26 17:26:52 +01:00
parent baab3e11b0
commit cb64f9eb10
No known key found for this signature in database
GPG key ID: 102E445F4C3F829B
2 changed files with 13 additions and 3 deletions

View file

@ -2,7 +2,12 @@
{% block content %}
<div><a href="..">..</a>/<span class="metaData">{{ page.slug }}</span></div>
<time datetime="{{ page.date }}">Published on: <span class="metaData">{{ page.date }}</span></time>
{% if config.extra.date_format.post %}
{% set datefmt = config.extra.date_format.post %}
{% else %}
{% set datefmt = "%Y-%m-%dT%H:%M:%S%Z" %}
{% endif %}
<time datetime="{{ page.date }}">Published on: <span class="metaData">{{ page.date | date(format=datefmt) }}</span></time>
{% if config.extra.author and config.extra.display_author == true %}
<address rel="author">By <span class="metaData">{{config.extra.author}}</span></address>
{% endif %}

View file

@ -12,12 +12,17 @@
{% endif %}
<ul class="titleList">
{% if config.extra.date_format.list %}
{% set datefmt = config.extra.date_format.list %}
{% else %}
{% set datefmt = "@ %Y-%m-%dT%H:%M:%S%Z" %}
{% endif %}
{% for page in pages %}
<li><a href="{{ page.permalink | safe }}">{{ page.title }}{% if config.extra.show_date_paginator and config.extra.show_date_paginator == true %}<span class="contentDate"> @ {{ page.date }}</span>{% endif %}</a></li>
<li><a href="{{ page.permalink | safe }}">{{ page.title }}{% if config.extra.show_date_paginator and config.extra.show_date_paginator == true %} <span class="contentDate">{{ page.date | date(format=datefmt) }}</span>{% endif %}</a></li>
{% endfor %}
</ul>
{% if paginator %}
<div class="metaData">{% if paginator.previous %}<a href="{{ paginator.first }}"></a> &nbsp; <a href="{{ paginator.previous }}"><</a>{% endif %} &nbsp; {{ paginator.current_index }} / {{ paginator.number_pagers }} &nbsp; {% if paginator.next %}<a href="{{ paginator.next }}"></a> &nbsp; <a href="{{ paginator.last }}"></a>{% endif %}</div>
<div class="metaData">{% if paginator.previous %}<a href="{{ paginator.first }}"></a> &nbsp; <a href="{{ paginator.previous }}"></a>{% endif %} &nbsp; {{ paginator.current_index }} / {{ paginator.number_pagers }} &nbsp; {% if paginator.next %}<a href="{{ paginator.next }}"></a> &nbsp; <a href="{{ paginator.last }}"></a>{% endif %}</div>
{% endif %}
{% endblock content %}