Omphaloskepsis-2/layouts/partials/single/main-header/warnings.html

34 lines
1.1 KiB
HTML
Raw Permalink Normal View History

{{- /*
Renders the automatic warnings for an item.
@params pc The page context.
*/
-}}
{{ $post_age_in_years := math.Round ( div ( div ( now.Sub .pc.PublishDate ).Hours 24 ) 365 ) }}
{{ if ( or .pc.Params.site .pc.Params.controversial ( gt $post_age_in_years 2 ) ) }}
<aside class="article-header__warnings">
<ul>
{{ if ( gt $post_age_in_years 2 ) }}
<li>
This piece was written <strong>over {{ $post_age_in_years }} years ago</strong>. It may no longer accurately reflect my views now,
or may be factually outdated.
</li>
{{ end }}
{{ if .pc.Params.controversial }}
<li>
This piece has been marked as potentially <strong>controversial</strong>, whether due to the topic addressed, the content of the
article, or both. Don't say you weren't warned.
</li>
{{ end }}
{{ if .pc.Params.site }}
<li>
This piece was originally written for an older version of this site. As such, it may not have transferred over properly and some
images and links might be broken.
</li>
{{ end }}
</ul>
</aside>
{{ end }}