aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Hamer <kevin@imarc.com>2020-10-11 17:35:30 -0400
committerMantas Vilčinskas <hi@mnts.lt>2020-10-27 21:38:46 +0200
commit49c081a97d8442a8267247a98d196fe05d7b3092 (patch)
tree66931542c2c88392a9f7eb5c0b745ca9c4186fd8
parentf5e7f886e79241f002cf28a1c8018d81fbd2ee57 (diff)
add .Site.Params.skipSeconds
-rw-r--r--exampleSite/config.yml5
-rw-r--r--layouts/partials/js.html6
2 files changed, 10 insertions, 1 deletions
diff --git a/exampleSite/config.yml b/exampleSite/config.yml
index 967505f..9060163 100644
--- a/exampleSite/config.yml
+++ b/exampleSite/config.yml
@@ -162,6 +162,11 @@ params:
# Default: true
useRelativeTime: true
+ # If enabled, doesn't show seconds on relative times.
+ #
+ # Default: false
+ skipSeconds: false
+
# What header design should we use?
#
# Default: true
diff --git a/layouts/partials/js.html b/layouts/partials/js.html
index c4c5a85..8465483 100644
--- a/layouts/partials/js.html
+++ b/layouts/partials/js.html
@@ -67,7 +67,11 @@
if (interval > 1) {
return interval + ' {{ T "minsAgo" }}';
}
- return Math.floor(seconds) + '{{ T "secondsAgo" }}';
+ {{ if .Site.Params.skipSeconds }}
+ return '<1 {{ T "minsAgo" }}'
+ {{ else }}
+ return Math.floor(seconds) + '{{ T "secondsAgo" }}';
+ {{ end }}
}
/**