Add a helper to format an article's timestamp.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="py-8 px-4 mx-auto max-w-screen-xl text-center lg:py-16 lg:px-6">
|
||||
<div class="mx-auto max-w-screen-sm">
|
||||
<h2 class="mb-1 text-4xl tracking-tight font-extrabold text-gray-900 dark:text-white">{{ article.title }}</h2>
|
||||
<p class="mb-3 text-base text-gray-500 dark:text-gray-400"><time pubdate datetime="2022-02-08" title="February 8th, 2022">Feb. 8, 2022 {{ article.created }}</time></p>
|
||||
<p class="mb-3 text-base text-gray-500 dark:text-gray-400">{{{ article-timestamp article.created }}}</time></p>
|
||||
|
||||
<p x-show="!showArticle" class="mb-4 font-light text-gray-500 lg:mb-8 sm:text-xl dark:text-gray-400"> {{ article.content }} </p>
|
||||
<p x-show="showArticle" class="mb-4 font-light text-gray-500 lg:mb-8 sm:text-xl dark:text-gray-400"> {{ article.content }} </p>
|
||||
|
||||
Reference in New Issue
Block a user