diff options
-rw-r--r-- | _config.yml | 2 | ||||
-rw-r--r-- | _layouts/index.html | 4 | ||||
-rw-r--r-- | atom.xml | 28 |
3 files changed, 34 insertions, 0 deletions
diff --git a/_config.yml b/_config.yml index 7fc5267..f4870e1 100644 --- a/_config.yml +++ b/_config.yml @@ -1,4 +1,6 @@ title: "Loek's Blog" +rss: + url: https://blog.pipeframe.xyz/atom.xml permalink: /post/:title exclude: - makefile diff --git a/_layouts/index.html b/_layouts/index.html index 2976df7..9f0f6d0 100644 --- a/_layouts/index.html +++ b/_layouts/index.html @@ -21,6 +21,10 @@ <!-- <MobileNavbar /> --> <div class='contentWrapper'> {{ content }} + {% if site.rss != nil %} + <p>An rss/atom feed of this blog is also available:</p> + <pre>{{ site.rss.url }}</pre> + {% endif %} <hr/> <h2>Recent posts</h2> <div class="recentPosts"> diff --git a/atom.xml b/atom.xml new file mode 100644 index 0000000..f882360 --- /dev/null +++ b/atom.xml @@ -0,0 +1,28 @@ +--- +# empty frontmatter to force this file to be interpreted using liquid +--- +{% for post in site.pages %} + {% if post.layout == "index" %} + {% assign index_post = post %} + {% endif %} +{% endfor %} +<?xml version="1.0" encoding="utf-8"?> +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title>{{ index_post.title }}</title> + <description>{{ index_post.content | markdownify | xml_escape }}</description> + <language>en-us</language> + <link>{{ site.rss.url }}</link> + <atom:link href="{{ site.rss.url }}" rel="self" type="application/rss+xml" /> + </channel> + {% for post in site.posts %} + <item> + <title>{{ post.title }}</title> + <guid>{{ post.id }}</guid> + <link>{{ post.url }}</link> + <pubDate>{{ post.date | date_to_xmlschema }}</pubDate> + <description>{{ post.content | markdownify | xml_escape }}</description> + </item> + {% endfor %} +</rss> + |