Saltycrane logo

SaltyCrane Blog

Notes on Python, Django, and web development on Ubuntu Linux

     Posts tagged "blogger"

Django Blog Project #16: Adding URL redirects using the Blogger API

I wanted to insert URL redirects on my old Blogger posts pointing to my new blog articles. A comment on my Migrating Blogger Posts post suggested that I use the (Python) Blogger API. This was a great suggestion. The Blogger API was well documented and easy to use. Here is the script I used to insert the URL redirects on each of my old Blogger posts.

from gdata import service
import re
import gdata
import atom

NEW_HTML = """
<script language="javascript">
  setTimeout('location.href="%s"', 2000);
</script>
<br /><br />
<b>
  </b><p>This is my OLD blog. I've copied this ...
... read more »

Django Blog Project #9: Migrating Blogger posts with Beautiful Soup

Last post, I talked about adding comments to my new sample blog application. This was about the last basic feature I needed to add before I started actually using it for real. Of course there are still a number of features I'd like to add, such as automatic syntax highlighting with Pygments, and incorporating django-tagging and some more intersting views, not to mention comment moderation. But I think those will have to wait-- I want to start using my new blog for real sometime.

So for the past few days, I've been working on my Beautiful Soup screen ...

... read more »

How to get syntax highlighting in Blogger with Pygments

  • $ sudo easy_install Pygments
  • $ pygmentize -f html myscript.py
  • copy html code to blog post
  • $ pygmentize -S default -f html
  • copy css to Blogger template

The Pygments website is located at: http://pygments.org

Update 5/21/2008: Andrew K. emailed me about a javascript syntax highlighter called highlight.js at http://softwaremaniacs.org/soft/highlight/en/. I have not tried it, but it looks pretty cool.

... read more »

Blogger expandable post summaries

Here is the link I used to get expandable post summaries on Blogger.

http://hackosphere.blogspot.com/2006/11/selective-expandable-posts.html

This hack avoids showing the "Read more..." link even if there is
nothing more to read. (The Blogger help article had this problem.)
However, this hack still has this problem if you click on the "Newer
Posts" or "Older Posts" at the bottom of the page.

Here is what's put in the post template:
Type your summary here
<span id="fullpost">
Type rest of the post here
</span>

... read more »
Created with Django | Hosted by Slicehost