Re-add text above old post content
This commit is contained in:
parent
44193cc4a9
commit
76773c4ad8
|
@ -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>
|
||||
|
|
12
source/_partials/post/old-post-message.html.twig
Normal file
12
source/_partials/post/old-post-message.html.twig
Normal 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 %}
|
Loading…
Reference in a new issue