diff options
author | Julio Capote <jcapote@gmail.com> | 2018-11-06 02:49:16 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2018-11-06 02:49:16 +0000 |
commit | a62a3e7755579d93ce3a87243dd277575930fffe (patch) | |
tree | 6d074f7294c5b7a45bed7ac229a6802830da2a04 /themes/even/layouts/partials/post/outdated-info-warning.html | |
download | capotej.com-a62a3e7755579d93ce3a87243dd277575930fffe.tar.gz |
init
Diffstat (limited to 'themes/even/layouts/partials/post/outdated-info-warning.html')
-rw-r--r-- | themes/even/layouts/partials/post/outdated-info-warning.html | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/themes/even/layouts/partials/post/outdated-info-warning.html b/themes/even/layouts/partials/post/outdated-info-warning.html new file mode 100644 index 0000000..3736c13 --- /dev/null +++ b/themes/even/layouts/partials/post/outdated-info-warning.html @@ -0,0 +1,28 @@ +{{- if or .Params.enableOutdatedInfoWarning (and .Site.Params.outdatedInfoWarning.enable (ne .Params.enableOutdatedInfoWarning false)) }} + {{- $daysAgo := div (sub now.Unix .Lastmod.Unix) 86400 }} + {{- $hintThreshold := .Site.Params.outdatedInfoWarning.hint | default 30 }} + {{- $warnThreshold := .Site.Params.outdatedInfoWarning.warn | default 180 }} + + {{- $updateTime := .Lastmod }} + {{- if .GitInfo }} + {{- if lt .GitInfo.AuthorDate.Unix .Lastmod.Unix }} + {{- $updateTime := .GitInfo.AuthorDate }} + {{- end }} + {{- end -}} + + {{- if gt $daysAgo $hintThreshold }} + <div class="post-outdated"> + {{- if gt $daysAgo $warnThreshold }} + <div class="warn"> + {{- else }} + <div class="hint"> + {{- end }} + <p>{{ T "outdatedInfoWarningBefore" -}} + <span class="timeago" datetime="{{ dateFormat "2006-01-02T15:04:05" $updateTime }}" title="{{ dateFormat "January 2, 2006" $updateTime }}"> + {{- dateFormat "January 2, 2006" $updateTime -}} + </span>{{ T "outdatedInfoWarningAfter" -}} + </p> + </div> + </div> + {{- end -}} +{{- end -}} |