summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorDmitry Ilvokhin <d@ilvokhin.com>2025-04-19 21:43:53 +0100
committerDmitry Ilvokhin <d@ilvokhin.com>2025-04-19 21:43:53 +0100
commit96d437baab4a622eb540719feb90ea810fb01756 (patch)
tree8757d41e9e2c673965483b2466ae306c9a7b8368 /templates
parentea523d411689338876abd7b87d85164009e7ec73 (diff)
downloadblog-master.tar.gz
blog-master.tar.bz2
blog-master.zip
Add support for atom / rss feedHEADmaster
Date format was changed to support `updated` in ISO format. Now every post will require date and time, which might be a usability regression, but we'll see. Also, `updated` field was introduced in metadata. If there is no such field, them date field will be used instead.
Diffstat (limited to 'templates')
-rw-r--r--templates/atom.xml24
-rw-r--r--templates/feed.html7
-rw-r--r--templates/post.html11
3 files changed, 37 insertions, 5 deletions
diff --git a/templates/atom.xml b/templates/atom.xml
new file mode 100644
index 0000000..ba7fbda
--- /dev/null
+++ b/templates/atom.xml
@@ -0,0 +1,24 @@
+<feed xmlns="http://www.w3.org/2005/Atom">
+ <title>blog.ilvokhin.com</title>
+ <id>tag:blog.ilvokhin.com,2022:blog.ilvokhin.com</id>
+ <link rel="alternate" href="https://blog.ilvokhin.com"></link>
+ <link rel="self" href="https://blog.ilvokhin.com/atom.xml"></link>
+ <updated>{{ updated.isoformat() }}</updated>
+ <author>
+ <name>Dmitry Ilvokhin</name>
+ <uri>https://ilvokhin.com/</uri>
+ <email>d@ilvokhin.com</email>
+ </author>
+{% if posts %}
+ {% for post in posts %}
+ <entry>
+ <title>{{ post.metadata.title }}</title>
+ <id>tag:blog.ilvokhin.com,2022:blog.ilvokhin.com/{{ post.name }}</id>
+ <link rel="alternate" href="https://blog.ilvokhin.com/{{ post.name }}"></link>
+ <published>{{ post.metadata.date.isoformat() }}</published>
+ <updated>{{ post.metadata.updated.isoformat() }}</updated>
+ <content type="html">{{ post.content }}</content>
+ </entry>
+ {% endfor %}
+{% endif %}
+</feed>
diff --git a/templates/feed.html b/templates/feed.html
index deb89c5..e17d3d0 100644
--- a/templates/feed.html
+++ b/templates/feed.html
@@ -28,8 +28,8 @@
<li>
<span>
<i>
- <time datetime="{{ post.metadata.date }}" pubdate>
- {{ post.metadata.date }}
+ <time datetime="{{ post.metadata.date.strftime('%Y-%m-%d') }}" pubdate>
+ {{ post.metadata.date.strftime('%Y-%m-%d') }}
</time>
</i>
</span>
@@ -41,6 +41,9 @@
</content>
</main>
+<footer>
+ <small><p><a class="rss" href="/atom.xml">Atom / RSS</a></p><small>
+</footer>
</body>
</html>
diff --git a/templates/post.html b/templates/post.html
index 20c3ac2..f61a2bd 100644
--- a/templates/post.html
+++ b/templates/post.html
@@ -22,9 +22,14 @@
<main>
<h1>{{ title }}</h1>
<p>
- <i><time datetime="{{ date }}" pubdate>
- {{ date }}
- </time></i>
+ <i>
+ <time datetime="{{ date.strftime('%Y-%m-%d') }}" pubdate>
+ {{ date.strftime('%Y-%m-%d') }}
+ </time>
+ {% if date != updated %}
+ (updated <time datetime="{{ updated.strftime('%Y-%m-%d') }}">{{ updated.strftime('%Y-%m-%d') }}</time>)
+ {% endif %}
+ </i>
{% if status == "draft" %}
• {{ status }}
{% endif %}