summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2023-05-23 12:14:00 -0500
committerStarfall <us@starfall.systems>2023-05-24 12:51:23 -0500
commit5c0a183a1d830479e4cfc705bdc9f13b2b1efac2 (patch)
tree40dc719987731076bcdc80632aefa4e74b1817d5 /src
parent1df389da097411e437aa33aa104132bc593e1ed4 (diff)
feature: atom feed
- add atom feed
- add theme-colored feed icon to /blog/
Diffstat (limited to 'src')
-rw-r--r--src/blog.njk14
-rw-r--r--src/feed.njk38
2 files changed, 52 insertions, 0 deletions
diff --git a/src/blog.njk b/src/blog.njk
index 4d8dfab..87cf12a 100644
--- a/src/blog.njk
+++ b/src/blog.njk
@@ -1,5 +1,6 @@
 ---
 layout = "base.njk"
+extraHeadContent = "<link rel=alternate type=application/atom+xml title=Atom href=feed.xml>"
 
 [pagination]
 data = "collections.post"
@@ -11,6 +12,18 @@ reverse = true
 key = "Blog"
 order = 1
 ---
+<style>
+.feed-icon {
+	display: block;
+	float: right;
+	height: 1em;
+	width: 1em;
+	background: url('/img/feed-icon.svg') center/contain, var(--fg);
+	background-blend-mode: luminosity;
+	mask: url('/img/feed-icon.svg') 0 0/100% 100%;
+}
+</style>
+<a href=feed.xml alt="Atom feed" class=feed-icon></a>
 {% for post in posts %}
 <article class=blogpost>
 	<h2><a href="{{ post.url | url }}">{{ post.data.title }}</a></h2>
@@ -22,3 +35,4 @@ order = 1
 	{%- endif -%}
 </article>
 {% endfor %}
+
diff --git a/src/feed.njk b/src/feed.njk
new file mode 100644
index 0000000..d1a9c0a
--- /dev/null
+++ b/src/feed.njk
@@ -0,0 +1,38 @@
+---
+permalink = "feed.xml"
+
+[metadata]
+name = "devin & Alex Starfall"
+email = "us@starfall.systems"
+baseurl = "https://starfall.systems/"
+blogurl = "https://starfall.systems/blog/"
+---
+<?xml version="1.0" encoding="utf-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom">
+	<title>Starfall's Blog</title>
+	<link href="{{ permalink | absoluteUrl(metadata.baseurl) }}" rel="self"/>
+	<link href="{{ metadata.blogurl }}"/>
+	<updated>{{ collections.post | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
+	<id>{{ metadata.baseurl }}</id>
+
+	<author>
+		<name>{{ metadata.name }}</name>
+		<email>{{ metadata.email }}</email>
+	</author>
+
+{% for post in collections.post | reverse %}
+{%- set absolutePostUrl = post.url | absoluteUrl(metadata.baseurl) %}
+	<entry>
+		<title>{{ post.data.title }}</title>
+		<updated>{{ post.date | dateToRfc3339 }}</updated>
+		<link href="{{ absolutePostUrl }}"/>
+		<id>{{ absolutePostUrl }}</id>
+		{%- if post.data.page.excerpt %}
+		<summary>{{- post.data.page.excerpt -}}</summary>
+		{% endif -%}
+		<content type="html">
+			{{- post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) -}}
+		</content>
+	</entry>
+{% endfor %}
+</feed>