Blog Updates

I implemented a few minor updates to the blog today that I wanted to spend a moment talking about.

Redirects

I added the django.contrib.redirects app to redirect requests for the old URLs from the Diario app to the new URLs under the Django Basic Blog app. I switched to Basic Blog about a month ago because I liked its structure and simplicity, but I noticed that I was still getting a lot of hits for the old URLs. I didn't realize that I was getting so many visitors from Google searches. Welcome! With the redirects in place, now visitors from Google's index will still get to the right place.

Code Highlighting

I wanted to implement code highlighting for the blog because I post a lot of code snippets here. The code was formatted simply as white text on a grey background, and it was easy to get lost in the code. I first tried jQuery's Chili syntax highlighter, but it needed a class to be added to the code block indicating the language. Since I'm using Markdown in my blog, that's not easy to do. Instead I decided to go with a modified version of Google's prettify.js from Remy Sharp that highlights every code tag without needing the "prettify" class.

To finish up, I used the Django Gedit colors that I wrote about here so that the highlighted code would match how it looks in Eclipse/PyDev/Aptana for me. Here's the CSS code:

:::css
.str { color: #fde661; }
.kwd { color: #ab5603; }
.com { color: #808080; }
.typ { color: #ffffff; }
.lit { color: #fde661; }
.pun { color: #92cc47; }
.pln { color: #ffffff; }
.tag { color: #ab5603; }
.atn { color: #92cc47; }
.atv { color: #f3ec61; }

Other Updates

I also added a "Recent Comments" section to the sidebar, ordered the months and years in the sidebar in descending order instead of ascending, and adjusted a few templates and CSS here and there. Let me know if you find any errors or have any comments.

Thanks!