14
Mar
2008

Filed under: django, seo

Generic search engine pinging for Django

The Django contrib sitemap framework provides a way to let Google know when your sitemap has been updated. It's simple enough to add Ask and Yahoo; until I can get a patch contributed, this module is an easy way to ping them all.

I use it with the Django dispatcher in my blog app's models.py to get my sites reindexed whenever an entry is updated:

def ping_search_engines(sender, instance, signal, *args, **kwargs):
  """
  Poke the search engines to get the site reindexed.
  """
  pingem = getattr(settings, 'BLOG_PINGTSE', False)
  if pingem:
    pingtse.ping_search_engines()

dispatcher.connect(
  ping_search_engines, 
  signal=signals.post_save, 
  sender=Entry
)

related files

Comments have been turned off for this article, but you can always contact us about it.