mirror of
https://github.com/Brandon-Rozek/website-theme.git
synced 2024-11-09 10:50:34 -05:00
Added post age warning
This commit is contained in:
parent
7b7136151b
commit
96efcabd22
2 changed files with 24 additions and 0 deletions
|
@ -18,6 +18,7 @@
|
||||||
{{ partial "date.html" . }}
|
{{ partial "date.html" . }}
|
||||||
{{ partial "reading_time.html" . }}
|
{{ partial "reading_time.html" . }}
|
||||||
{{ partial "tags/page.html" . }}
|
{{ partial "tags/page.html" . }}
|
||||||
|
{{ partial "age_warning.html" . }}
|
||||||
<!-- content -->
|
<!-- content -->
|
||||||
<div class="e-content">
|
<div class="e-content">
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
|
|
23
layouts/partials/age_warning.html
Normal file
23
layouts/partials/age_warning.html
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
|
||||||
|
{{ 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 }}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue