How about submitting that as a patch that so others can use contrib.sitemaps to ping non-google search engines?
In an effort to play around with the sitemaps contrib package I decided to add a sitemap to this website. It's pretty intuitive and easy, so there is really no excuse not to put a sitemap on your site. It's about 15 minutes worth of effort and 2 changes. The effort comes when you don't want to ignore every search engine other than google. Let's start by adding a site map then we'll show how to ping Yahoo and Ask as well.
Step One: add 'django.contrib.sitemaps', to your installed apps.
Step Two: Modify your root url conf:
from django.contrib.sitemaps import GenericSitemap
#import your modules
from coltrane.models import Entry, Link
sitemaps = {
'entries' : GenericSitemap({ 'queryset': Entry.objects.all(),
'date_field': 'pub_date'},
changefreq = 'never', priority = 0.4)
'links' : GenericSitemap({ 'queryset': Link.objects.all(),
'date_field': 'pub_date'},
changefreq = 'never', priority = 0.4 }
}
#Modify your url patterns
url(r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap',
{'sitemaps': sitemaps}, name='sitemap')
Be forewarned. If you use the tagging module you will probably have to move the sitemap declarations out of the urls.py because of the tagging register function. It will throw something like 'Model already registered'
What I don't like about the sitemaps package is the ping_google() function. How about we rename it to 'ping_search_engines' and allow you to ping Yahoo and Ask.com as well? Here's what I did to add that functionality.
First we need to add the additional ping urls to your settings file. this is a good reference for adding sitemaps.
SITEMAP_PING_URLS = (
'http://search.yahooapis.com/SiteExplorerService/V1/ping',
'http://submissions.ask.com/ping',
'http://www.google.com/webmasters/tools/ping',
'http://webmaster.live.com/ping.aspx',
)
Next we create a dispatcher to iterate over those urls and send the updated sitemap.
from django.db.models.signals import post_save
from django.contrib.sitemaps import ping_google
from django.core.urlresolvers import reverse
from django.conf import settings
from coltrane.models import Entry
def ping_search_engines(sender, instance, created, **kwargs):
# Business Logic, I just send the sitemap
# when an entry is created.
if created:
# We do this once now, so ping_google
# doesn't do it for every iteration.
sitemap_url = reverse('sitemap')
for ping_url in settings.SITEMAP_PING_URLS :
ping_google(sitemap_url, ping_url)
post_save.connect(ping_search_engines, sender=Entry)
With this in place we now send our update requests to Google, Yahoo and Ask. Yahoo doesn't require you to register your site, per their ping api. Ask doesn't require any extra work either per their help docs. However in order for Google to accept your ping you need to register your site through Google's Webmaster tools. It's a simple process similar to the one below for Window's Live search.
In true Microsoft fashion they had to be different. Using the method I described above you can send a notification to Window's Live Search, but I have no idea if it's going to work. Why you ask? Well their GET parameter is 'siteMap', instead of the Django hard coded value of 'sitemap.' Playing around with the service, I always receive the same success message no matter what I pass in the get params. It wouldn't be that hard to fix, but I'm lazy and I'll just wait for this patch. To make sure my sitemap was added used the Windows Live Webmaster tools located here. The first step is to get a Microsoft Live id and sign in to use the tools. Select add a site and give them your website url and sitemap.xml url. Once you submit this you will get a meta tag for authentication that looks something like this:
You can add it to the base.html, or for cleaner results just put it on the template that your homepage hits.
How about submitting that as a patch that so others can use contrib.sitemaps to ping non-google search engines?
@Tom. Looks like someone skipped the last paragraph. Check out the existing patch.
I'm a developer out of San Francisco CA working at a startup.
This space will deal with the work I've participated in using the Django framework to build applications for enterprise clients.
Finally, you should follow me on twitter.
"generic z-pak <a href=http://sefsa.org>buy azithromycin</a>"
at 7:53p.m. Aug. 27, 2010 | permalink
"How do i come up with cash from online gambling? <img>http://shrtn.info/smile/ref.php</img>"
at 2:50a.m. Aug. 25, 2010 | permalink
"http://needman.ru замуж за иностранца <a href=http://needman.ru>знакомства с иностранцами</a>"
at 12:59p.m. May 18, 2010 | permalink
"Yebhewjw <a href="http://yebhewjw.de">yebhewjw</a> http://yebhewjw.de yebhewjw http://yebhewjw.de"
at 11:41p.m. April 29, 2010 | permalink
"Thanks for this, unbelievable our developer has a robots no follow tag on our site, no wonder it wasn't being found by the search engines ..."
at 7:40a.m. March 2, 2010 | permalink
"maybe you are right. but how often robots.txt is actually accessed? and how much overhead there is? I'm curious - quantitatively - how big of ..."
at 7:13p.m. Dec. 12, 2009 | permalink
"Lovely idea! Thanks for sharing. I'm gonna have a closer look at the patch for Django 1.2. This could help switching template engines a lot. ..."
at 9:14a.m. Nov. 2, 2009 | permalink
"That was an inspiring post, I think Drupal is great! how could you hate it so much, Thanks for writing, most people don't bother."
at 11:14a.m. Oct. 28, 2009 | permalink
"@Evgeniy. Yes at: http://code.google.com/p/django-alfresco/"
at 10:42a.m. Oct. 22, 2009 | permalink
"Is this released as an open source project?"
at 1:21a.m. Oct. 22, 2009 | permalink
"Interesting, thanks for the examples that you have shared, these are great... Anyway, thanks for the post"
at 7:55a.m. Oct. 16, 2009 | permalink
"Quite inspiring, looks pretty easy aswell, as you have laid it out in such a way, great work, keep it up Thanks for bringing this ..."
at 10:01a.m. Oct. 8, 2009 | permalink
nice!
i'm using this guide to setup my sitemaps... can u believe i didn't know django.contrib.sitemaps existed?!