From f99d0303a489a443b964be891f5b8c484b4bc9bb Mon Sep 17 00:00:00 2001 From: Nick Sergeant Date: Mon, 18 Jun 2012 12:39:36 -0400 Subject: [PATCH] Better blog RSS --- blogs/templates/blogs/themes/default/rss.xml | 29 +++++++++++++++ blogs/views.py | 2 +- templates/rss.xml | 38 +++++--------------- 3 files changed, 38 insertions(+), 31 deletions(-) create mode 100644 blogs/templates/blogs/themes/default/rss.xml diff --git a/blogs/templates/blogs/themes/default/rss.xml b/blogs/templates/blogs/themes/default/rss.xml new file mode 100644 index 0000000..815dedf --- /dev/null +++ b/blogs/templates/blogs/themes/default/rss.xml @@ -0,0 +1,29 @@ + + + {% if request.blog_user.username == 'nick' %} + + Nick Sergeant + Nick Sergeant + http://nicksergeant.com/?rss + {% elif request.blog_user.username == 'blog' %} + + Snipt Blog + Snipt Blog + https://blog.snipt.net/?rss + {% else %} + + {% if request.blog_user.username == 'nick' %}Nick Sergeant{% else %}{{ request.blog_user.username }}{% endif %} + {% if request.blog_user.username == 'nick' %}Nick Sergeant{% else %}{{ request.blog_user.username }}{% endif %} + https://{{ request.blog_user.username }}.snipt.net/?rss + {% endif %} + {% for snipt in snipts %} + + {{ snipt.title }} + {{ snipt.get_full_absolute_url }} + + {{ snipt.created|date:"r" }} + snipt-net-{{ snipt.id }} + + {% endfor %} + + diff --git a/blogs/views.py b/blogs/views.py index 05dd148..80ea78f 100644 --- a/blogs/views.py +++ b/blogs/views.py @@ -58,7 +58,7 @@ def blog_post(request, username_or_custom_slug): def rss(request, context): return render_to_response( - 'rss.xml', + 'blogs/themes/default/rss.xml', context, context_instance=RequestContext(request), mimetype="application/rss+xml" diff --git a/templates/rss.xml b/templates/rss.xml index ce3dcc8..4de4340 100644 --- a/templates/rss.xml +++ b/templates/rss.xml @@ -1,39 +1,17 @@ - {% if request.blog_user %} - {% if request.blog_user.username == 'nick' %} - - Nick Sergeant - Nick Sergeant - http://nicksergeant.com/?rss - {% elif request.blog_user.username == 'blog' %} - - Snipt Blog - Snipt Blog - https://blog.snipt.net/?rss - {% else %} - - {% if request.blog_user.username == 'nick' %}Nick Sergeant{% else %}{{ request.blog_user.username }}{% endif %} - {% if request.blog_user.username == 'nick' %}Nick Sergeant{% else %}{{ request.blog_user.username }}{% endif %} - https://{{ request.blog_user.username }}.snipt.net/?rss - {% endif %} - {% else %} - - {% if public and not public_user %}Public snipts{% else %}Snipts by {{ user.username }}{% endif %}{% if tag %} tagged with "{{ tag }}"{% endif %} - / {% if public and not public_user %}public{% else %}{{ user.username }}{% endif %}{% if tag %} / {{ tag }}{% endif %} - Snipt - https://snipt.net{{ request.path }} - {% endif %} - {% for snipt in snipts %} + + {% if public and not public_user %}Public snipts{% else %}Snipts by {{ user.username }}{% endif %}{% if tag %} tagged with "{{ tag }}"{% endif %} + / {% if public and not public_user %}public{% else %}{{ user.username }}{% endif %}{% if tag %} / {{ tag }}{% endif %} - Snipt + https://snipt.net{{ request.path }} + {% for snipt in snipts %} {{ snipt.title }} {{ snipt.get_full_absolute_url }} - {% if snipt.user.username == 'blog' %} - - {% else %} - - {% endif %} + {{ snipt.created|date:"r" }} snipt-net-{{ snipt.id }} - {% endfor %} + + {% endfor %}