Re-add text above old post content

This commit is contained in:
Oliver Davies 2021-07-01 17:53:07 +01:00
parent 44193cc4a9
commit 76773c4ad8
2 changed files with 19 additions and 1 deletions

View file

@ -5,10 +5,16 @@
<div class="space-y-6">
<header>
<time datetime="{{ page.date|date('Y-m-d') }}">
{{- page.date|date('jS F Y') -}}
Posted on {{ page.date|date('jS F Y') -}}
</time>
</header>
<div>
{% include 'post/old-post-message' with {
post: page,
} only %}
</div>
<div class="markdown">
{{ parent() }}
</div>

View file

@ -0,0 +1,12 @@
{% macro shouldDisplayOldPostMessage(post) %}
{% set cutOffDate = 'today -1 year'|date('U') %}
{{ post.date <= cutOffDate }}
{% endmacro %}
{% import _self as helpers %}
{% if helpers.shouldDisplayOldPostMessage(post)|trim %}
<div class="p-6 my-10 border border-gray-300 dark:bg-gray-800 dark:border-gray-700">
<p><strong>Warning:</strong> This post is over a year old. I don't always update old posts with new information, so some of this information may be out of date.</p>
</div>
{% endif %}