templates_blog_DATA = \
src/templates/blog/author.html \
src/templates/blog/base.html \
+ src/templates/blog/feed.xml \
src/templates/blog/index.html \
src/templates/blog/post.html \
src/templates/blog/search-results.html
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<rss version="2.0"
+ xmlns:content="http://purl.org/rss/1.0/modules/content/"
+ xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">
+ <channel>
+ <title>IPFire Blog</title>
+ <atom:link href="https://blog.ipfire.org/feed.xml" rel="self" type="application/rss+xml" />
+ <link>https://blog.ipfire.org</link>
+ <description>The official blog of the IPFire Project</description>
+ <lastBuildDate>{{ now }}</lastBuildDate>
+ <language>en-GB</language>
+ <sy:updatePeriod>hourly</sy:updatePeriod>
+ <sy:updateFrequency>1</sy:updateFrequency>
+
+ <image>
+ <url>https://www.ipfire.org{{ static_url("img/tux/ipfire_tux_32x32.png") }}</url>
+ <title>IPFire Blog</title>
+ <link>https://blog.ipfire.org</link>
+ <width>32</width>
+ <height>32</height>
+ </image>
+
+ <atom:link rel="payment" title="Donate!" href="https://www.ipfire.org/donate" type="text/html" />
+
+ {% for post in posts %}
+ <item>
+ <title>{{ post.title }}</title>
+ <link>https://blog.ipfire.org/post/{{ post.slug }}</link>
+ <author>{{ post.author.email }} ({{ post.author.name }})</author>
+ <pubDate>{{ post.published.strftime("%a, %d %b %Y %H:%M:%S +0200") }}</pubDate>
+ <guid isPermaLink="false"></guid>
+ <description><![CDATA[{% raw post.text %}]]></description>
+ </item>
+ {% end %}
+ </channel>
+</rss>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<rss version="2.0">
- <channel>
- <title>{% block title %}{% end block %}</title>
- <link>{% block url %}{% end block %}</link>
- <description>{% block description %}{% end block %}</description>
- <language>en_GB</language>
- <copyright>{% block copyright %}IPFire Team{% end block %}</copyright>
- <pubDate>Thu, 8 Nov 2007 00:00:00 +0200</pubDate>
- {% for item in items %}
- <item>
- <title>{{ item.title }}</title>
- <link>{{ item.url }}</link>
- <author>{{ item.author.email }} ({{ item.author.name }})</author>
- <guid>{{ item.url }}</guid>
- <pubDate>{{ item.published.strftime("%a, %d %b %Y %H:%M:%S +0200") }}</pubDate>
- <description>
- <![CDATA[{% raw item.markup %}]]>
- </description>
- </item>
- {% end %}
- </channel>
-</rss>
+++ /dev/null
-{% extends "base.xml" %}
-
-{% block title %}IPFire.org - News{% end block%}
-{% block url %}http://www.ipfire.org/{% end block %}
-{% block description %}IPFire News Feed{% end block %}
+++ /dev/null
-{% extends "base.xml" %}
-
-{% block title %}planet.ipfire.org{% end block%}
-{% block url %}http://planet.ipfire.org/{% end block %}
-{% block description %}IPFire Planet Feed{% end block %}
(r"/donation", tornado.web.RedirectHandler, { "url" : "/donate" }),
# RSS feed
- (r"/news.rss", tornado.web.RedirectHandler, { "url" : "https://blog.ipfire.org/feed.rss" }),
+ (r"/news.rss", tornado.web.RedirectHandler, { "url" : "https://blog.ipfire.org/feed.xml" }),
# Redirect news articles to blog
(r"/news/(.*)", tornado.web.RedirectHandler, { "url" : "https://blog.ipfire.org/posts/{1}" }),
(r"/authors/(\w+)", blog.AuthorHandler),
(r"/post/(.*)", blog.PostHandler),
(r"/search", blog.SearchHandler),
+
+ # RSS Feed
+ (r"/feed.xml", blog.FeedHandler),
])
# downloads.ipfire.org
(r"/user/([a-z0-9_-]+)", tornado.web.RedirectHandler, { "url" : "https://blog.ipfire.org/authors/{1}" }),
# RSS
- (r"/rss", tornado.web.RedirectHandler, { "url" : "https://blog.ipfire.org/feed.rss" }),
+ (r"/rss", tornado.web.RedirectHandler, { "url" : "https://blog.ipfire.org/feed.xml" }),
(r"/user/([a-z0-9_-]+)/rss", tornado.web.RedirectHandler, { "url" : "https://blog.ipfire.org/authors/{1}.rss" }),
- (r"/news.rss", tornado.web.RedirectHandler, { "url" : "https://blog.ipfire.org/feed.rss" }),
+ (r"/news.rss", tornado.web.RedirectHandler, { "url" : "https://blog.ipfire.org/feed.xml" }),
])
# fireinfo.ipfire.org
#!/usr/bin/python
+import email.utils
import tornado.web
import handlers_base as base
self.render("blog/author.html", author=author, posts=posts)
+class FeedHandler(base.BaseHandler):
+ def get(self):
+ cache_key = "%s-%s" % (self.request.host, self.request.path)
+
+ # Get feed from cache if possible
+ feed = self.memcached.get(cache_key)
+ if not feed:
+ posts = self.planet.get_entries(limit=50)
+
+ # Render the feed
+ feed = self.render_string("blog/feed.xml", posts=posts,
+ now=email.utils.formatdate())
+
+ # Store in cache for 5min
+ self.memcached.set(cache_key, feed, 300)
+
+ # Set correct content type
+ self.set_header("Content-Type", "application/rss+xml")
+
+ # Deliver content
+ self.finish(feed)
+
+
class PostHandler(base.BaseHandler):
def get(self, slug):
entry = self.planet.get_entry_by_slug(slug)