diff -r 25c7466925f7 django/contrib/sitemaps/__init__.py
a
|
b
|
|
79 | 79 | 'location': loc, |
80 | 80 | 'lastmod': self.__get('lastmod', item, None), |
81 | 81 | 'changefreq': self.__get('changefreq', item, None), |
82 | | 'priority': str(priority is not None and priority or '') |
| 82 | 'priority': str(priority is not None and priority or ''), |
| 83 | 'item': item, |
83 | 84 | } |
84 | 85 | urls.append(url_info) |
85 | 86 | return urls |
diff -r 25c7466925f7 django/contrib/sitemaps/tests/basic.py
a
|
b
|
|
2 | 2 | from datetime import date |
3 | 3 | from django.conf import settings |
4 | 4 | from django.contrib.auth.models import User |
5 | | from django.contrib.sitemaps import Sitemap |
| 5 | from django.contrib.sitemaps import Sitemap, GenericSitemap |
6 | 6 | from django.contrib.sites.models import Site |
7 | 7 | from django.core.exceptions import ImproperlyConfigured |
8 | 8 | from django.test import TestCase |
… |
… |
|
171 | 171 | """ |
172 | 172 | Site._meta.installed = False |
173 | 173 | self.assertRaises(ImproperlyConfigured, Sitemap().get_urls) |
| 174 | |
| 175 | def test_sitemap_item(self): |
| 176 | """ |
| 177 | Check to make sure that the raw item is included with each |
| 178 | Sitemap.get_url() url result. |
| 179 | """ |
| 180 | user_sitemap = GenericSitemap({ |
| 181 | 'queryset': User.objects.all() |
| 182 | }) |
| 183 | |
| 184 | item_in_url_info = all(map( |
| 185 | lambda url: isinstance(url['item'], User), |
| 186 | user_sitemap.get_urls() |
| 187 | )) |
| 188 | |
| 189 | self.assertTrue(item_in_url_info) |
| 190 | |
| 191 | No newline at end of file |
diff -r 25c7466925f7 docs/ref/contrib/sitemaps.txt
a
|
b
|
|
313 | 313 | }), |
314 | 314 | ) |
315 | 315 | |
| 316 | Index |
| 317 | ----- |
| 318 | |
| 319 | The variable `sitemaps` is a list of absolute URLs to each of the sitemaps. |
| 320 | |
| 321 | Sitemap |
| 322 | ------- |
| 323 | |
| 324 | The variable `urlset` is a list of each URLs that should appear in the sitemap. Each URL exposes `changefreq`, `item`, `lastmod`, `location` and `priority`. |
| 325 | |
| 326 | .. versionadded:: SVN |
| 327 | |
| 328 | The `item` object has been added for each URL to allow for more flexible customization. |
| 329 | |
316 | 330 | Pinging Google |
317 | 331 | ============== |
318 | 332 | |