1

I'm using the Django Cms 2.3.5 and I was generating the sitemap like this article from the docs

Now my question is there a easy solution to hide two pages from this sitemap because. I have the 404 and the 500 error in my CMS integrated and I dont want that there are in the sitemap!?

Has somebody an idea?

Azd325
  • 5,752
  • 5
  • 34
  • 57

2 Answers2

4

I would try it this way:

Create a new class, and override the get_url method of SiteMap class

class CustomCMSSitemap(CMSSitemap):
    def get_urls(self, *args, **kwargs):
       super(CustomCMSSitemap, self).get_urls(*args, **kwargs)
       //your code here

Here is the source for the class SiteMap

Instead of adding url(r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': {'cmspages': CMSSitemap}}) into the main urls.py, add url(r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': {'cmspages': CustomCMSSitemap}})

Dave
  • 6,141
  • 2
  • 38
  • 65
karthikr
  • 97,368
  • 26
  • 197
  • 188
0

The easiest way to remove a page from the sitemap in django-cms is unpublishing it. Specially if that page is not ready yet (outputs 404 or 500 errors).

m0y
  • 137
  • 2
  • 9