diff options
author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-01-29 09:30:28 +0000 |
---|---|---|
committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-01-29 09:30:28 +0000 |
commit | 123f567093eb3bd2f9cb295f4553eb62433c2962 (patch) | |
tree | b26414d7b818785cf5ed68ba6b7ad93cfd492aea /docs/ref | |
parent | d9061c01a975c3313a815f793cd773d3e657c3cf (diff) | |
download | django-123f567093eb3bd2f9cb295f4553eb62433c2962.tar.gz |
Fixed #2713 -- Made the name of the sitemap view a parameter of the sitemap index view, in order to allow decorators. Also cleaned up code in the area and removed redundant comments from the tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17408 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/ref')
-rw-r--r-- | docs/ref/contrib/sitemaps.txt | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/docs/ref/contrib/sitemaps.txt b/docs/ref/contrib/sitemaps.txt index f3ca8d1031..f4ae417666 100644 --- a/docs/ref/contrib/sitemaps.txt +++ b/docs/ref/contrib/sitemaps.txt @@ -293,11 +293,30 @@ You should create an index file if one of your sitemaps has more than 50,000 URLs. In this case, Django will automatically paginate the sitemap, and the index will reflect that. -.. versionadded:: 1.3 +.. versionadded:: 1.4 + +If you are not using the vanilla sitemap view -- for example, if it is wrapped +with a caching decorator -- you must name your sitemap view and pass +``sitemap_url_name`` to the index view:: + + from django.contrib.sitemaps import views as sitemaps_views + from django.views.decorators.cache import cache_page + + urlpatterns = patterns('', + url(r'^sitemap.xml$', + cache_page(86400)(sitemaps_views.index), + {'sitemaps': sitemaps, 'sitemap_url_name': 'sitemaps'}), + url(r'^sitemap-(?P<section>.+)\.xml$', + cache_page(86400)(sitemaps_views.sitemap), + {'sitemaps': sitemaps}, name='sitemaps'), + ) + Template customization ====================== +.. versionadded:: 1.3 + If you wish to use a different template for each sitemap or sitemap index available on your site, you may specify it by passing a ``template_name`` parameter to the ``sitemap`` and ``index`` views via the URLconf:: |