website-theme/layouts/partials/age_warning.html

24 lines
591 B
HTML
Raw Normal View History

2024-02-16 13:01:59 -05:00
{{ if and (not .Date.IsZero) .Site.Params.warnPostOlderThanXYears }}
{{ $ageYears := div (sub now.Unix .Date.Unix) 31536000 }}
{{ if .Lastmod }}
{{ $ageYears := div (sub now.Unix .Lastmod.Unix) 31536000 }}
{{ end }}
{{ if gt $ageYears .Site.Params.warnPostOlderThanXYears }}
<div style="margin-top: 1rem; border: 1px solid black; padding: 1rem;">
<em>Warning</em>: This post has not been modified
for over {{ .Site.Params.warnPostOlderThanXYears }} years. For technical posts,
make sure that it is still relevant.
</div>
{{ end }}
{{ end }}