diff --git a/makefile b/makefile
index d41e247..32f7f82 100644
--- a/makefile
+++ b/makefile
@@ -7,12 +7,16 @@ PYTHON ::= venv/bin/python
.PHONY: all clean public
-all: $(BUILD_DIR)/index.html $(BUILD_DIR)/syntax.css public $(BLOG_HTML)
+all: $(BUILD_DIR)/index.html $(BUILD_DIR)/feed.xml $(BUILD_DIR)/syntax.css public $(BLOG_HTML)
$(BUILD_DIR)/index.html: templates/index.html $(BLOG) page.py
@mkdir -p "$(@D)"
$(PYTHON) page.py --index "$<" "$@" $(BLOG)
+$(BUILD_DIR)/rss.xml: $(BLOG) rss.py page.py
+ @mkdir -p "$(@D)"
+ $(PYTHON) rss.py $(BLOG) > "$@"
+
$(BUILD_DIR)/blog/%.html: blog/%.md templates/blog.html page.py
@mkdir -p "$(@D)"
$(PYTHON) page.py "$<" "$@"
diff --git a/rss.py b/rss.py
new file mode 100755
index 0000000..05f4115
--- /dev/null
+++ b/rss.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python3
+
+import sys
+from functools import partial as p
+from ipo import ipo, write, starstarmap
+
+from page import blog_page_metadata
+
+
+BASE_URL = "https://www.braindeaddev.com/P5t7oFqPF7oEX"
+
+DOC_TEMPLATE = """
+
+
+ Midgard's blog
+
+ {last_updated}
+ Midgard
+ {url}{0}
+
+"""
+
+ITEM_TEMPLATE = """
+ -
+ {title}
+ {path}
+ {published_rfc822}
+ {url}
+ {summary}
+
"""
+ # {category}
+
+
+def iso8601torfc822(iso8601):
+ # pylint: disable=invalid-name
+ y, m, d = map(int, iso8601.split("-"))
+ month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][m]
+ return f"{d} {month} {y} 00:00:00 UTC"
+
+
+def main():
+ items = (
+ ipo(sys.argv[1:]) |
+ p(map, blog_page_metadata) |
+ p(sorted, key=lambda x: x["published"]) |
+ p(map, lambda x: {
+ **x,
+ "published_rfc822": iso8601torfc822(x["published"]),
+ "url": BASE_URL + x["path"]
+ }) | list
+ )
+
+ last_date = items.data[-1]["published_rfc822"]
+
+ (
+ items |
+ p(starstarmap, ITEM_TEMPLATE.format) |
+ "".join |
+ p(DOC_TEMPLATE.format, url=BASE_URL, last_updated=last_date) |
+ write
+ )
+
+if __name__ == '__main__':
+ main()