mirror of
https://github.com/jbowdre/virtuallypotato.git
synced 2024-11-22 06:52:18 +00:00
Merge pull request #19 from jbowdre/flag_old_posts
display a notice on posts which haven't been updated in more than a year
This commit is contained in:
commit
9d87ff0eac
2 changed files with 13 additions and 1 deletions
|
@ -32,4 +32,7 @@ other = "Search Results"
|
||||||
other = "Query is too short"
|
other = "Query is too short"
|
||||||
|
|
||||||
[type_to_search]
|
[type_to_search]
|
||||||
other = "Type to search"
|
other = "Type to search"
|
||||||
|
|
||||||
|
[old_content]
|
||||||
|
other = "What you're about to read hasn't been updated in more than a year. The information may be out of date. Drop a comment below if you find something that needs updating."
|
|
@ -1,6 +1,7 @@
|
||||||
{{- define "main" }}
|
{{- define "main" }}
|
||||||
{{- $s := .Site.Params }}
|
{{- $s := .Site.Params }}
|
||||||
{{- $p := .Params }}
|
{{- $p := .Params }}
|
||||||
|
{{- $ageDays := div (sub now.Unix .Date.Unix) 86400 }}
|
||||||
{{- $scratch := newScratch }}
|
{{- $scratch := newScratch }}
|
||||||
{{- if isset $p "image" }}
|
{{- if isset $p "image" }}
|
||||||
{{- $scratch.Set "image" $p.image }}
|
{{- $scratch.Set "image" $p.image }}
|
||||||
|
@ -14,6 +15,14 @@
|
||||||
{{- $t := .Title }}
|
{{- $t := .Title }}
|
||||||
<h1 class="post_title">{{ $t }}</h1>
|
<h1 class="post_title">{{ $t }}</h1>
|
||||||
{{- partial "post-meta" . }}
|
{{- partial "post-meta" . }}
|
||||||
|
{{ with .Param "lastmod" }}
|
||||||
|
{{ $ageDays = div (sub now.Unix .Unix) 86400 }}
|
||||||
|
{{ end }}
|
||||||
|
{{ if gt $ageDays 365 }}
|
||||||
|
<div class="notices info"><div class="label">Technology keeps moving but this post has not.</div>
|
||||||
|
<i>{{ T "old_content" }}</i>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
{{- partial "image-feature" . }}
|
{{- partial "image-feature" . }}
|
||||||
{{ if and (gt .WordCount 400 ) (gt (len .TableOfContents) 180) ($s.toc) }}
|
{{ if and (gt .WordCount 400 ) (gt (len .TableOfContents) 180) ($s.toc) }}
|
||||||
<div class="post_toc">
|
<div class="post_toc">
|
||||||
|
|
Loading…
Reference in a new issue