aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfabrixxm <fabrix.xm@gmail.com>2021-03-18 16:00:23 +0100
committerfabrixxm <fabrix.xm@gmail.com>2021-03-18 16:00:23 +0100
commit768de298cb1babd3a9e4fcbce74d78d369210caa (patch)
tree8caa66248a098da3065056ef7ca7cf67dfa19297
parentb5d445a5a11918b6d41cd0e8be9677e8963b05dc (diff)
Add atom feed
-rw-r--r--templates/web/atom.xml28
-rw-r--r--templates/web/base.html5
2 files changed, 32 insertions, 1 deletions
diff --git a/templates/web/atom.xml b/templates/web/atom.xml
new file mode 100644
index 0000000..3948538
--- /dev/null
+++ b/templates/web/atom.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom">
+
+ <title>{% if q %}Results for '{{ q }}' - {% endif %}{{ settings.name }}</title>
+ <link href="{{ siteurl }}" />
+ <link href="{{ siteurl }}/atom.xml{% if q %}?q={{ q|urlencode }}{% endif %}" rel="self" />
+ <updated>{{ entries.0.data.updated }}</updated>
+ <id></id>
+
+ {% for entry in entries %}
+ <entry>
+ <title>{{ entry.data.title }}</title>
+ <link href="{{ siteurl }}{{ url_for('entry', eid=entry.eid) }}"/>
+ <id>urn:uuid:{{ entry.eid }}</id>
+ <updated>{{ entry.data.updated }}</updated>
+ <summary>{{ entry.data.description }}</summary>
+ <content type="xhtml">
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ <p>{{ entry.data.description }} - {{ entry.data.url }}</p>
+ <p>{% for tag in entry.data.tags %}
+ #<a class="tag" href="{{ siteurl }}{{ url_for('search') }}?q=tags:{{tag|urlencode}}">{{ tag }}</a>
+ {% endfor %}</p>
+ </div>
+ </content>
+ </entry>
+ {% endfor %}
+
+</feed>
diff --git a/templates/web/base.html b/templates/web/base.html
index 018d66a..a2a8097 100644
--- a/templates/web/base.html
+++ b/templates/web/base.html
@@ -5,7 +5,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- <link rel="stylesheet" type="text/css" href="links.css"> -->
<link rel="shortcut icon" href="favicon.ico">
- <link rel="alternate" type="application/rss+xml" title="RSS" href="/rss">
+ <link rel="alternate" type="application/atom+xml" href="/atom.xml" title="Atom Feed"/>
+ {% if q %}
+ <link rel="alternate" type="application/atom+xml" href="/atom.xml?q={{ q|urlencode }}" title="Results for '{{ q }}'"/>
+ {% endif %}
<title>{% block title %}Linkopedia{% endblock %}</title>
<style>
html { width: 100%; }