Hello,

I'm trying to implement the a sitemap.xml file using the
contrib.sitemaps framework. It's pretty simple to use, but the output
I'm getting is not correct.

My code in sitemaps.py is as follows. Notice I've used the optional
location() method.:

from django.contrib.sitemaps import Sitemap
from jonatkinson.blog.models import Post

class BlogSitemap(Sitemap):
        changefreq = "weekly"
        priority = 0.5

        def items(self):
                return Post.objects.all()

        def lastmod(self, obj):
                return obj.date

        def location(self, obj):
                return "/blog/%s" % obj.slug

And a snippet of the output I'm getting is:

<urlset>

        <url>
<loc>http://example.com/blog/ghetto-backup</loc>
<lastmod>2007-06-25</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>

        <url>

        <loc>
http://example.com/blog/removing-.svn-from-a-subversion-repository
</loc>
<lastmod>2007-05-25</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>

As you can see, the locations generated includes 'example.com', which
is not correct. According to the documentation, the location method is
supposed to "URL that doesn't include the protocol or domain"[1]. I'm
guessing that the sitemaps framework is somehow tied to the sites
framework. Has anyone else come across this issue before?

Thanks,

--Jon

[1] http://www.djangoproject.com/documentation/sitemaps/#location

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to