Questions tagged [django-sitemaps]

Django framework for generating sitemaps

Django comes with a high-level sitemap-generating framework that makes creating sitemap XML files easy.

A sitemap is an XML file on your Web site that tells search-engine indexers how frequently your pages change and how “important” certain pages are in relation to other pages on your site. This information helps search engines index your site.

The Django sitemap framework automates the creation of this XML file by letting you express this information in Python code.

It works much like Django’s syndication framework. To create a sitemap, just write a Sitemap class and point to it in your URLconf.

53 questions
6
votes
2 answers

How to create index for django sitemaps for over 50.000 urls

I have the following url configuration url(r'^sitemap\.xml$', index, {'sitemaps': sitemaps}), url(r'^sitemap-(?P
.+)\.xml', cache_page(86400)(sitemap), {'sitemaps': sitemaps}), and sitemaps include following sitemap class…
tuna
  • 6,211
  • 11
  • 43
  • 63
5
votes
3 answers

Add image field to XML sitemap in Django

Google recognizes an tag for XML sitemaps (http://support.google.com/webmasters/bin/answer.py?hl=en&answer=178636), and I would like to include an image attribute into my sitemaps. So, something like this is needed to get the cover_image…
AAA
  • 1,962
  • 4
  • 30
  • 55
4
votes
3 answers

django sitemap DoesNotExist at /sitemap.xml

when i add sitemap to my Django project i got this error .. DoesNotExist at /sitemap.xml Site matching query does not exist. sitemap.py : from django.contrib.sitemaps import Sitemap from .models import Homepage class DynamicSitemap(Sitemap): …
3
votes
2 answers

Django Sitemaps : Get only pages of the current website

I would like to create a Site specific Sitemap using Django Sitemaps. My idea was to do something like this : def items(self): current_site = Site.objects.get_current(self.request) return current_site.pages.filter(draft=False) But I have…
Natim
  • 17,274
  • 23
  • 92
  • 150
3
votes
1 answer

Generate Django sitemap while using site framework

I am using sites framework with RequestSite (no SITE_ID set) to generate content based on domain. I need to generate sitemaps for each domain with different results but I didnt find a way how to make this two frameworks work together. Is there any…
igo
  • 6,359
  • 6
  • 42
  • 51
3
votes
0 answers

Making django sitemaps work with google

One issue I get is that I suspect the content_type is incorrect for Google to see the sitemaps.xml correctly - it highlights the issue with: Your Sitemap appears to be an HTML page. Please use a supported sitemap format instead. So, I suspect I…
disruptive
  • 5,687
  • 15
  • 71
  • 135
3
votes
4 answers

What is the correct way to include subdomains to the Django sitemap urls?

I have my development site (localhost.com 'as on the development machine'). This domain has got two subdomains, developer and blog. The url configuration for sitemaps are, from django.contrib.sitemaps.views import sitemap, index as…
All Іѕ Vаиітy
  • 24,861
  • 16
  • 87
  • 111
3
votes
3 answers

Django 1.6: name 'sitemaps' is not defined

I'm trying to implement sitemaps in my django application but i get the following error. I'm using the django sitemap's framework. I don't know what I'm doing wrong. Traceback: File "mysite/urls.py" in 3. from sitemap import * File…
James L.
  • 1,143
  • 22
  • 52
2
votes
1 answer

Reverse for 'django.contrib.sitemaps.views.sitemap' with keyword arguments '{'section': 'evergreen'}' not found

Django 3.0.8 Python 3.8.0 How can I cope with sitemap sections? class EvergreenPostSitemap(Sitemap): changefreq = 'monthly' priority = 0.8 protocol = 'https' def items(self): return…
Michael
  • 4,273
  • 3
  • 40
  • 69
2
votes
1 answer

Generating a django sitemap without regard to models?

All the examples I have seen for generating sitemaps in Django seem to iterate over a model, to generate URLs that way. For example, from the Django documentation: class BlogSitemap(Sitemap): changefreq = "never" priority = 0.5 def…
Jake Rankin
  • 714
  • 6
  • 22
2
votes
2 answers

Django Sitemap Framework. Accepting query parameters

I'm using the Django Sitemap Framework I've no problem retrieving a list of articles from my DB. class ArticleSitemap(Sitemap): def items(self): return articles.objects.filter(tagid=1399).order_by('-publisheddate') I now want to accept…
sidarcy
  • 2,958
  • 2
  • 36
  • 37
2
votes
1 answer

how do I add homepage to Django sitemap?

The sitemap given sitemap class generates a sitemap at the location, example.com/sitemap.xml from django.contrib.sitemaps import Sitemap from blog.models import Entry for the given Sitemap class, class BlogSitemap(Sitemap): changefreq = "never" …
All Іѕ Vаиітy
  • 24,861
  • 16
  • 87
  • 111
2
votes
2 answers

Django 1.6: What should be the location of the sitemap.py file?

I want to implement django sitemaps but I'm little confused about where to put the sitemaps.py file and which urls.py file should i modify to include: url(r'^sitemap.xml$', 'django.contrib.sitemaps.views.index', {'sitemaps': sitemaps}), Shall I…
James L.
  • 1,143
  • 22
  • 52
1
vote
1 answer

Django sitemap for dynamic static pages

I have the following in my views.py: ACCEPTED = ["x", "y", "z", ...] def index(request, param): if not (param in ACCEPTED): raise Http404 return render(request, "index.html", {"param": param}) Url is simple…
darkhorse
  • 8,192
  • 21
  • 72
  • 148
1
vote
1 answer

Django sitemap.xml. Why I am getting example.com in the file?

I generate sitemap.xml on the development server, but instead of 127.0.0.1 I get example.com in he URL. I have nowhere in the code reference to example.com. - - http://example.com/xxxx/ABCDE/ - - What…
cegthgtlhj
  • 191
  • 1
  • 8
1
2 3 4