commit 71dc0fbe5de22414f9435b6207759b69b263ec9b
parent 4d64e6d08721e72d44845953fcf3cc318ef08ec2
Author: Dan Callaghan <djc@djc.id.au>
Date: Sat, 20 Sep 2008 22:34:31 +1000
links from a YAML file (instead of hardcoded in templates)
Diffstat:
2 files changed, 19 insertions(+), 32 deletions(-)
diff --git a/config.defaults b/config.defaults
@@ -30,6 +30,12 @@ entries_in_feed = 20
# utf8!
encoding = utf8
+[links]
+
+# The name of the YAML file containing links to be placed at the bottom of
+# every page. Leaving this blank disables the link section.
+filename =
+
[blog]
# The directory containing blog entries.
diff --git a/templates/_commonwrapper.xml b/templates/_commonwrapper.xml
@@ -6,6 +6,10 @@
<xi:include href="_fragments.xml" />
+<?python
+import yaml
+?>
+
<py:match path="head">
<head profile="http://gmpg.org/xfn/11" py:attrs="select('@*')" py:with="title = unicode(select('title[1]/text()'))">
${select('./*[local-name() != "title"]')}
@@ -24,39 +28,16 @@
${select('./*')}
</div>
</div>
- <div id="links">
- <div class="linkrow">
- <h2>Me</h2>
- <p>
- <a href="http://www.librarything.com/profile/danc86" rel="me" title="My library">Books</a> ${inline_sep()}
- <a href="http://www.imdb.com/mymovies/list?l=1447320&s=reverse_uservote" rel="me" title="My IMDB voting history">Movies</a> ${inline_sep()}
- <a href="http://www.last.fm/user/danc86" rel="me" title="My last.fm profile">Music</a> ${inline_sep()}
- <a href="http://flickr.com/photos/danc86" rel="me" title="My Flickr account">Photos</a>
- </p>
- </div>
- <div class="linkrow">
- <h2>Randoms</h2>
- <p>
- <a href="http://www.houseofzeus.com/notblog/" rel="friend met">flash</a> ${inline_sep()}
- <a href="http://protiotype.net/" rel="friend met">io</a> ${inline_sep()}
- <a href="http://www.sjkingston.com/" rel="friend met crush">Kingo</a> ${inline_sep()}
- <a href="http://mondodev.net/" rel="friend met">mondo</a> ${inline_sep()}
- <a href="http://myspace.com/nath520" rel="friend met" title="Fellow SPLC loser">Nath</a> ${inline_sep()}
- <a href="http://myspace.com/reesb" rel="friend met">ReesB</a> ${inline_sep()}
- <a href="http://www.train-meditations.com/" rel="friend met">Shaun</a> ${inline_sep()}
- <a href="http://koffein.net/" rel="friend met crush">stl</a> ${inline_sep()}
- <a href="http://myspace.com/heartfelt4ever" rel="friend met">Zeke</a>
- </p>
- </div>
- <div class="linkrow">
- <h2>Recommended reading</h2>
+ <div id="links"
+ py:if="config.getunicode('links', 'filename')"
+ py:with="link_sections = yaml.load(open(config.getunicode('links', 'filename'), 'r'))">
+ <div class="linkrow" py:for="section, links in link_sections.iteritems()">
+ <h2>${section}</h2>
<p>
- <a href="http://www.aaronsw.com/weblog/">Aaron Swartz</a> ${inline_sep()}
- <a href="http://www.boingboing.net/">Boing Boing</a> ${inline_sep()}
- <a href="http://www.qwantz.com/">Dinosaur Comics</a> ${inline_sep()}
- <a href="http://untoward.livejournal.com/">Joey Comeau</a> ${inline_sep()}
- <a href="http://reversecowgirlblog.blogspot.com/">Reverse Cowgirl</a> ${inline_sep()}
- <a href="http://xkcd.com/">xkcd</a>
+ <py:for each="n, link in enumerate(links)">
+ <py:if test="n > 0">${inline_sep()}</py:if>
+ <a py:attrs="dict((a, v) for a, v in link.iteritems() if a != 'anchor')">${link['anchor']}</a>
+ </py:for>
</p>
</div>
</div>