django-static-sitemaps icon indicating copy to clipboard operation
django-static-sitemaps copied to clipboard

No way to change default protocol for relative URLs

Open oppianmatt opened this issue 8 years ago • 2 comments

Can't see how to change to https (which should be the default). It looks hardcoded:

    @staticmethod
    def normalize_url(url):
        if url[-1] != '/':
            url += '/'
        if not url.startswith(('http://', 'https://')):
            if url.startswith('/'):
                from django.contrib.sites.models import Site
                url = 'http://' + Site.objects.get_current().domain + url
            else:
                url = 'http://' + url
        return url

oppianmatt avatar Jul 14 '16 11:07 oppianmatt

If anyone else, you can set it via STATICSITEMAPS_URL but that means you don't use the sites framework since you need to set the full domain as well as.

oppianmatt avatar Jul 14 '16 11:07 oppianmatt

@oppianmatt You're right. Once again, PR with this feature will be gladly accepted. Improvement should be very easy to implement.

xaralis avatar Jul 25 '16 07:07 xaralis