diff options
Diffstat (limited to 'themes/default/layouts/partials/meta-expirydate.html')
-rw-r--r-- | themes/default/layouts/partials/meta-expirydate.html | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/themes/default/layouts/partials/meta-expirydate.html b/themes/default/layouts/partials/meta-expirydate.html new file mode 100644 index 0000000..1feefd1 --- /dev/null +++ b/themes/default/layouts/partials/meta-expirydate.html @@ -0,0 +1,20 @@ +{{- if .ExpiryDate -}} + {{- $expired := and .ExpiryDate (ge now.Unix .ExpiryDate.Unix) -}} + {{- $diff := now.Sub .ExpiryDate -}} + {{- $duration := lang.FormatNumberCustom 0 (math.Round (mul (div $diff.Hours 24) -1)) -}} + {{- $date := .ExpiryDate | time.Format "Monday, January 2 2006 at 15:04:05 MST" -}} + {{- $title := print "Self destructs within" " " $duration " " "days" " " "(" $date ")" -}} + {{- if $expired -}} + {{- $title = print "Self destructed" " " $date -}} + {{- end -}} + + <meta-expiry + title="{{ $title }}"> + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/trash-2.svg")) -}} + <time datetime= "{{- .ExpiryDate | time.Format "2006-01-02T15:04:05Z" -}}"> + {{- .ExpiryDate | time.Format "Jan 2 2006" -}} +{{- /* This comment removes trailing newlines and white spaces. */ -}} + </time> +{{- /* This comment removes trailing newlines and white spaces. */ -}} + </meta-expiry> +{{- end -}} |