-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added google map support with better user freedom on sitemap url conf…
…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
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}}),), | ||
... | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from cms_sitemap import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|