shithub: werc

Download patch

ref: b468c65539870921fc80652f08bf1eb22c658ece
parent: f127e707377690669fad0f81a46e74d68f990246
author: uriel <uriel@suckless.org>
date: Tue Sep 30 11:28:48 EDT 2008

Brown paper bag bugfix, make rss feeds work again!

--- a/bin/controller.rc
+++ b/bin/controller.rc
@@ -216,6 +216,16 @@
     if not if (~ $body *.html && test -f $body)
         set_handler html_handler $body
 
+    # Rss feeds. TODO: we should check that the request is for a real blog dir
+    if not if (~ $REQUEST_URI */index.rss) {
+        uri = `{echo $uri | sed 's/index.rss$//'}
+        if (~ $blogDirs 0)
+            blogDirs = $sitedir^$uri
+        uri=$baseuri$"uri
+        master_template=feeds/rss20.tpl
+        response_format=raw
+    }
+
     # Blog handler
     if not if (~ $body */[bB]log/index */[bB]log//index || ! ~ $#blogDirs 0) {
         if (~ $#blogDirs 0)
@@ -228,16 +238,6 @@
 '
 
         set_handler blog_dir_handler $blogDirs
-    }
-
-    # Rss feeds. TODO: we should check that the request is for a real blog dir
-    if not if (~ $REQUEST_URI */index.rss) {
-        uri = `{echo $uri | sed 's/index.rss$//'}
-        if (~ $blogDirs 0)
-            blogDirs = $sitedir^$uri
-        uri=$baseuri$"uri
-        master_template=feeds/rss20.tpl
-        response_format=raw
     }
 
     # Global tpl (eg sitemap.tpl)
--- a/lib/feeds/rss20.tpl
+++ b/lib/feeds/rss20.tpl
@@ -1,5 +1,7 @@
 Content-Type: text/xml; charset=utf-8
 
+<?xml version="1.0" encoding="UTF-8"?>
+
 %{
 fn statpost {
 	f = $1
@@ -25,7 +27,6 @@
 
 %}
 
-<?xml version="1.0" encoding="UTF-8"?>
 <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
 	<channel>
 		<atom:link href="%('http://'$site^$REQUEST_URI%)" rel="self" type="application/rss+xml" />