summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Hovorka <[email protected]>2022-10-25 10:59:23 -0600
committerAlexis Hovorka <[email protected]>2022-10-25 10:59:23 -0600
commit85d82f4dfce3f2b791cffb6e3bcf70e0d0c6df25 (patch)
treea2ea2fac2334669616e6307fc3bc9a0c2528ae65
parent634301e45433bf06fcdae500d51275677e568adb (diff)
[feat] Add post dates
-rw-r--r--layouts/post.njk4
-rw-r--r--posts/feed.njk1
-rw-r--r--posts/history.njk2
-rw-r--r--posts/index.njk2
-rw-r--r--static/style.css14
5 files changed, 19 insertions, 4 deletions
diff --git a/layouts/post.njk b/layouts/post.njk
index 0c0e4a9..53deceb 100644
--- a/layouts/post.njk
+++ b/layouts/post.njk
@@ -4,10 +4,12 @@ layout: page.njk
<a id="up" title="Home" aria-label="Home" href="/"></a>
<a id="back" title="Back" aria-label="Back" href="javascript:history.back()"></a>
<h1>{{ title }}</h1>
+ {%- set postDate = date.toISOString().slice(0,10) %}
+ <p class="post-date"><time datetime="{{ postDate }}">{{ postDate }}</time></p>
{%- if heroImg %}
<img class="hero" src="{{ heroImg }}" alt="{{ heroImgAlt }}">
- {% endif -%}
+ {%- endif %}
{{ content | safe }}
diff --git a/posts/feed.njk b/posts/feed.njk
index 1ad22fa..fc3abd7 100644
--- a/posts/feed.njk
+++ b/posts/feed.njk
@@ -23,6 +23,7 @@
<entry>
<title>{{ post.data.title }}</title>
<link href="{{ absolutePostUrl }}"/>
+ {% set postDate = post.date.setUTCHours(7) -%}
<updated>{{ post.date | dateToRfc3339 }}</updated>
<id>{{ absolutePostUrl }}</id>
<content type="html"><![CDATA[{{ post | excerpt | htmlToAbsoluteUrls(absolutePostUrl) | demark | safe }}<p><a href="{{ absolutePostUrl }}">Read the full post online</a></p>]]></content>
diff --git a/posts/history.njk b/posts/history.njk
index 76fbcd0..c3cdc50 100644
--- a/posts/history.njk
+++ b/posts/history.njk
@@ -16,6 +16,8 @@
<hr>
<section>
<h2><a href="{{ post.url }}">{{ post.data.title }}</a></h2>
+ {%- set postDate = post.date.toISOString().slice(0,10) %}
+ <p class="post-date"><time datetime="{{ postDate }}">{{ postDate }}</time></p>
{{ post | excerpt | safe }}
</section>
{% endfor %}
diff --git a/posts/index.njk b/posts/index.njk
index f695075..64ea7a6 100644
--- a/posts/index.njk
+++ b/posts/index.njk
@@ -13,6 +13,8 @@
{% set post = collections.all.slice(-1)[0] -%}
<h2><a href="{{ post.url }}">{{ post.data.title }}</a></h2>
+ {%- set postDate = post.date.toISOString().slice(0,10) %}
+ <p class="post-date"><time datetime="{{ postDate }}">{{ postDate }}</time></p>
{{ post.templateContent | fixAnchors(post.url) | safe }}
diff --git a/static/style.css b/static/style.css
index 8ac1f13..64973ab 100644
--- a/static/style.css
+++ b/static/style.css
@@ -126,6 +126,17 @@ main {
main * { margin: 1rem 0 }
+h1, h1 * { font-size: 26px }
+h2, h2 * { font-size: 22px }
+
+p.post-date {
+ margin: -1rem 0 -.2rem;
+}
+p.post-date * {
+ font-size: 15px;
+ color: #999;
+}
+
[lang=jpn], [lang=jpn] * {
font-size: 17px;
}
@@ -193,9 +204,6 @@ hr {
border-top: .5px solid rgba(0,0,0,.2);
}
-h1, h1 * { font-size: 26px }
-h2, h2 * { font-size: 22px }
-
img:not(.emoji) {
display: block;
max-width: 100%;