Skip to content

Commit

Permalink
Added google map support with better user freedom on sitemap url conf…
Browse files Browse the repository at this point in the history
…iguraton

Signed-off-by: Patrick Lauber <patrick.lauber@divio.ch>
  • Loading branch information
wid authored and Patrick Lauber committed Sep 22, 2009
1 parent 80c5c38 commit 7bf36fd
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
34 changes: 34 additions & 0 deletions cms/docs/sitemap.txt
@@ -0,0 +1,34 @@
Sitemap Guide
==================

Sitemap
-------

Sitemap are xml files fetched by google to help your site indexation.
You have to tell google were the sitemap with the **Webmaster Tools**

The CMSSitemap will create a sitemap with all the published pages of your cms

Apps
----

Add the following to your project's ``INSTALLED_APPS`` setting::

INSTALLED_APPS = (
...
'django.contrib.sitemaps',
...
)

urls.py
-------

In your main ``urls.py`` add the following import at the top of the file:
from cms.sitemaps import CMSSitemap

Then add the following line at the **start** of the ``urlpatterns`` definition::

urlpatterns = (
url(r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': {'cmspages': CMSSitemap}}),),
...
)
1 change: 1 addition & 0 deletions cms/sitemaps/__init__.py
@@ -0,0 +1 @@
from cms_sitemap import *
16 changes: 16 additions & 0 deletions cms/sitemaps/cms_sitemap.py
@@ -0,0 +1,16 @@
from django.contrib.sitemaps import Sitemap
from cms.utils.moderator import get_page_queryset
from cms.models import Page

class CMSSitemap(Sitemap):
changefreq = "monthly"
priority = 0.5

def items(self):
page_queryset = get_page_queryset(None)
all_pages = page_queryset.published()
return all_pages

def lastmod(self, page):
return page.publication_date or page.creation_date

0 comments on commit 7bf36fd

Please sign in to comment.