diff options
| author | Jannis Leidel <jannis@leidel.info> | 2010-12-12 22:56:29 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2010-12-12 22:56:29 +0000 |
| commit | d0257a1558524158379bc2bf6bef2bc2a8811840 (patch) | |
| tree | 00db8cbe6d2254b1fbf8bae24b1561cfe7d1ee50 /docs/ref | |
| parent | b3520da9ac113ed435cb6aa135b0559780d9c530 (diff) | |
Fixed #14041 -- Added ability to override the template of the sitemaps views. Thanks, julien.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14883 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/contrib/sitemaps.txt | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/docs/ref/contrib/sitemaps.txt b/docs/ref/contrib/sitemaps.txt index b58b55cab4..a9b1d08f66 100644 --- a/docs/ref/contrib/sitemaps.txt +++ b/docs/ref/contrib/sitemaps.txt @@ -279,8 +279,10 @@ references individual sitemap files, one per each section defined in your Here's what the relevant URLconf lines would look like for the example above:: - (r'^sitemap\.xml$', 'django.contrib.sitemaps.views.index', {'sitemaps': sitemaps}), - (r'^sitemap-(?P<section>.+)\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}), + urlpatterns = patterns('django.contrib.sitemaps.views', + (r'^sitemap\.xml$', 'index', {'sitemaps': sitemaps}), + (r'^sitemap-(?P<section>.+)\.xml$', 'sitemap', {'sitemaps': sitemaps}), + ) This will automatically generate a :file:`sitemap.xml` file that references both :file:`sitemap-flatpages.xml` and :file:`sitemap-blog.xml`. The @@ -291,6 +293,26 @@ 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 + +Template customization +====================== + +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:: + + urlpatterns = patterns('django.contrib.sitemaps.views', + (r'^custom-sitemap\.xml$', 'index', { + 'sitemaps': sitemaps, + 'template_name': 'custom_sitemap.html' + }), + (r'^custom-sitemap-(?P<section>.+)\.xml$', 'sitemap', { + 'sitemaps': sitemaps, + 'template_name': 'custom_sitemap.html' + }), + ) + Pinging Google ============== |
