Add a helper to format an article's timestamp.

This commit is contained in:
2024-04-11 11:17:42 +03:00
parent cbc813924e
commit 9d7ec9888b
3 changed files with 19 additions and 1 deletions
+14
View File
@@ -13,6 +13,20 @@
(fn [timestamp]
(format timestamp "HH:mm MMM. do, yyyy"))))
(defn article-timestamp-factory
[]
(clj->js
(fn [timestamp]
(str "<time pubdate=\""
(format timestamp "yyyy-MM-dd")
"\" datetime=\""
(format timestamp "yyyy-MM-dd")
"\" title=\""
(format timestamp "MMMM do, yyyy")
"\">"
(format timestamp "MMMM do, yyyy")
"</time>"))))
(defn is-brief-factory
[]
(clj->js
+4
View File
@@ -20,6 +20,10 @@
"full-timestamp"
(helpers/full-timestamp-factory))
(.registerHelper (.-handlebars hbs)
"article-timestamp"
(helpers/article-timestamp-factory))
(.registerHelper (.-handlebars hbs)
"truncatestring"
(helpers/truncatestring-factory))