gozzilli
gozzilli

Reputation: 8357

Django sitemap - double http:// in front of URL

In Django 1.4.12, I have a Sitemap class:

class MySitemap(Sitemap):
    def items(self):
        return ['/my/url1/',
                '/my/url2/',]

    def location(self, obj):
        return str(obj)

and in urls.py

sitemaps = {
            'global': MySitemap,
            }

...

urlpatterns = patterns('',
...
url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),

However, my generate sitemap.xml has http://http:// in front of it, such as:

...
<url><loc>http://http://mywebsite.com/my/url1</loc></url>
...

What is causing this problem?

Upvotes: 2

Views: 695

Answers (1)

knbk
knbk

Reputation: 53719

You have probably included http:// in your Site object's domain name from the sites framework (django.contrib.sites). Remove it.

This field should only include the actual domain name, not the protocol, as the protocol itself can change (e.g. to https://).

Upvotes: 6

Related Questions