Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h2>This is where I write.</h2>
<ul>
{% for post in posts %}
<li>
<b><a href='{{ ROOT_URL }}/{{ post.path }}'>{{ post.title }}</a></b>
<b><a href='{% url '/' %}{{ post.path }}'>{{ post.title }}</a></b>
by {{ post.author }} at {{ post.date|date:"F j Y" }}<br>
{{ post.body|truncatewords_html:30}}
</li>
Expand Down
30 changes: 30 additions & 0 deletions pages/rss.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

<title><![CDATA[Blog Title]]></title>
<link href="{{ siteURL }}/rss.xml" rel="self"/>
<link href="{{ siteURL }}"/>
<id>{{ siteURL }}</id>
{% for post in posts %}
{% if forloop.first %}
<updated>{{ post.date|date:"c" }}></updated>
<author>
<name><![CDATA[{{ post.author }}]]></name>
<email><![CDATA[dev.null@gmail.com]]></email>
</author>
{% endif %}
{% endfor %}
<generator uri="http://cactusformac.com/">Cactus for Mac</generator>

{% for post in posts %}
{% if forloop.counter < 20 %}
<entry>
<title type="html"><![CDATA[{{ post.title }}]]></title>
<link href="{{ siteURL }}/{{ post.path }}"/>
<updated>{{ post.date|date:"c" }}</updated>
<id>{{ siteURL }}/{{ post.path }}</id>
<content type="html"><![CDATA[{{ post.body }}]]></content>
</entry>
{% endif %}
{% endfor %}
</feed>
6 changes: 6 additions & 0 deletions plugins/blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
ORDER = 999
POSTS_PATH = 'posts/'
POSTS = []
SITE_URL = 'http://your_blog.com'

from django.template import Context
from django.template.loader import get_template
Expand Down Expand Up @@ -83,5 +84,10 @@ def preBuildPage(site, page, context, data):
for post in POSTS:
if post['path'] == page.path:
context.update(post)

"""
Site URL used by the rss page.
"""
context['siteURL'] = SITE_URL

return context, data
5 changes: 3 additions & 2 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Welcome</title>

<link rel="shortcut icon" href="{{ STATIC_URL }}/favicon.ico">
<link rel="stylesheet" href="{{ STATIC_URL }}/css/master.css" type="text/css" media="screen" charset="utf-8">
<link rel="shortcut icon" href="{% static '/favicon.ico' %}">
<link rel="stylesheet" href="{% static '/css/master.css' %}" type="text/css" media="screen" charset="utf-8">
<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="/rss.xml">

</head>
<body>
Expand Down
4 changes: 2 additions & 2 deletions templates/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<nav>
<span class="prev">
{% if prevPost %}
<a href='{{ ROOT_URL }}/{{ prevPost.path }}'>
<a href='{% url '/' %}{{ prevPost.path }}'>
&laquo; {{ prevPost.title }}
</a>
{% else %}
Expand All @@ -18,7 +18,7 @@

<span class="next">
{% if nextPost %}
<a href='{{ ROOT_URL }}/{{ nextPost.path }}'>
<a href='{% url '/' %}{{ nextPost.path }}'>
{{ nextPost.title }} &raquo;
</a>
{% else %}
Expand Down