Fixed #3033 -- Extended django.contrib.sitemaps to support new, generic sitemap protocol rather than Google's proprietary version. Thanks, Petar Marić

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4088 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-11-20 16:32:40 +00:00
parent d2180a6bf3
commit f759dac2c9
3 changed files with 12 additions and 11 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% spaceless %} {% spaceless %}
{% for url in urlset %} {% for url in urlset %}
<url> <url>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84"> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemapindex/0.9">
{% for location in sitemaps %}<sitemap><loc>{{ location|escape }}</loc></sitemap>{% endfor %} {% for location in sitemaps %}<sitemap><loc>{{ location|escape }}</loc></sitemap>{% endfor %}
</sitemapindex> </sitemapindex>

View File

@ -5,9 +5,9 @@ The sitemap framework
**New in Django development version**. **New in Django development version**.
Django comes with a high-level sitemap-generating framework that makes Django comes with a high-level sitemap-generating framework that makes
creating `Google Sitemap`_ XML files easy. creating sitemap_ XML files easy.
.. _Google Sitemap: http://www.google.com/webmasters/sitemaps/docs/en/protocol.html .. _sitemap: http://www.sitemaps.org/
Overview Overview
======== ========
@ -55,11 +55,12 @@ URLconf_:
This tells Django to build a sitemap when a client accesses ``/sitemap.xml``. This tells Django to build a sitemap when a client accesses ``/sitemap.xml``.
The name of the sitemap file is not important, but the location is. Google will The name of the sitemap file is not important, but the location is. Search
only index links in your sitemap for the current URL level and below. For engines will only index links in your sitemap for the current URL level and
instance, if ``sitemap.xml`` lives in your root directory, it may reference any below. For instance, if ``sitemap.xml`` lives in your root directory, it may
URL in your site. However, if your sitemap lives at ``/content/sitemap.xml``, reference any URL in your site. However, if your sitemap lives at
it may only reference URLs that begin with ``/content/``. ``/content/sitemap.xml``, it may only reference URLs that begin with
``/content/``.
The sitemap view takes an extra, required argument: ``{'sitemaps': sitemaps}``. The sitemap view takes an extra, required argument: ``{'sitemaps': sitemaps}``.
``sitemaps`` should be a dictionary that maps a short section label (e.g., ``sitemaps`` should be a dictionary that maps a short section label (e.g.,
@ -199,9 +200,9 @@ If it's an attribute, its value should be either a string or float representing
the priority of *every* object returned by ``items()``. the priority of *every* object returned by ``items()``.
Example values for ``priority``: ``0.4``, ``1.0``. The default priority of a Example values for ``priority``: ``0.4``, ``1.0``. The default priority of a
page is ``0.5``. See Google's documentation for more documentation. page is ``0.5``. See the `sitemaps.org documentation`_ for more.
.. _Google's documentation: http://www.google.com/webmasters/sitemaps/docs/en/protocol.html .. _sitemaps.org documentation: http://www.sitemaps.org/protocol.html#prioritydef
Shortcuts Shortcuts
========= =========