Django

Code

Changeset 3699

Show
Ignore:
Timestamp:
08/31/06 18:44:26 (2 years ago)
Author:
adrian
Message:

Renamed django.contrib.sitemap to django.contrib.sitemaps, to be more consistent with our plural form for these sorts of things.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/sitemaps.txt

    r3698 r3699  
    3232To install the sitemap app, follow these steps: 
    3333 
    34     1. Add ``'django.contrib.sitemap'`` to your INSTALLED_APPS_ setting. 
     34    1. Add ``'django.contrib.sitemaps'`` to your INSTALLED_APPS_ setting. 
    3535    2. Make sure ``'django.template.loaders.app_directories.load_template_source'`` 
    3636       is in your TEMPLATE_LOADERS_ setting. It's in there by default, so 
     
    5252URLconf_: 
    5353 
    54     (r'^sitemap.xml$', 'django.contrib.sitemap.views.sitemap', {'sitemaps': sitemaps}) 
     54    (r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}) 
    5555 
    5656This tells Django to build a sitemap when a client accesses ``/sitemap.xml``. 
     
    8383`Creating a sitemap index`_ below.) 
    8484 
    85 ``Sitemap`` classes must subclass ``django.contrib.sitemap.Sitemap``. They can 
     85``Sitemap`` classes must subclass ``django.contrib.sitemaps.Sitemap``. They can 
    8686live anywhere in your codebase. 
    8787 
     
    9393your sitemap class might look:: 
    9494 
    95     from django.contrib.sitemap import Sitemap 
     95    from django.contrib.sitemaps import Sitemap 
    9696    from mysite.blog.models import Entry 
    9797 
     
    240240 
    241241    from django.conf.urls.defaults import * 
    242     from django.contrib.sitemap import FlatPageSitemap, GenericSitemap 
     242    from django.contrib.sitemaps import FlatPageSitemap, GenericSitemap 
    243243    from mysite.blog.models import Entry 
    244244 
     
    258258 
    259259        # the sitemap 
    260         (r'^sitemap.xml$', 'django.contrib.sitemap.views.sitemap', {'sitemaps': sitemaps}) 
     260        (r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}) 
    261261    ) 
    262262 
     
    270270``sitemaps`` dictionary. The only differences in usage are: 
    271271 
    272     * You use two views in your URLconf: ``django.contrib.sitemap.views.index`` 
    273       and ``django.contrib.sitemap.views.sitemap``. 
    274     * The ``django.contrib.sitemap.views.sitemap`` view should take a 
     272    * You use two views in your URLconf: ``django.contrib.sitemaps.views.index`` 
     273      and ``django.contrib.sitemaps.views.sitemap``. 
     274    * The ``django.contrib.sitemaps.views.sitemap`` view should take a 
    275275      ``section`` keyword argument. 
    276276 
    277277Here is what the relevant URLconf lines would look like for the example above:: 
    278278 
    279     (r'^sitemap.xml$', 'django.contrib.sitemap.views.index', {'sitemaps': sitemaps}) 
    280     (r'^sitemap-(?P<section>.+).xml$', 'django.contrib.sitemap.views.sitemap', {'sitemaps': sitemaps}) 
     279    (r'^sitemap.xml$', 'django.contrib.sitemaps.views.index', {'sitemaps': sitemaps}) 
     280    (r'^sitemap-(?P<section>.+).xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}) 
    281281 
    282282This will automatically generate a ``sitemap.xml`` file that references 
     
    289289You may want to "ping" Google when your sitemap changes, to let it know to 
    290290reindex your site. The framework provides a function to do just that: 
    291 ``django.contrib.sitemap.ping_google()``. 
     291``django.contrib.sitemaps.ping_google()``. 
    292292 
    293293``ping_google()`` takes an optional argument, ``sitemap_url``, which should be 
     
    297297 
    298298``ping_google()`` raises the exception 
    299 ``django.contrib.sitemap.SitemapNotFound`` if it cannot determine your sitemap 
     299``django.contrib.sitemaps.SitemapNotFound`` if it cannot determine your sitemap 
    300300URL. 
    301301 
    302302One useful way to call ``ping_google()`` is from a model's ``save()`` method:: 
    303303 
    304     from django.contrib.sitemap import ping_google 
     304    from django.contrib.sitemaps import ping_google 
    305305 
    306306    class Entry(models.Model):