API

sitemapper.sitemaps

class sitemapper.sitemaps.SitemapBase

Bases: django.contrib.sitemaps.Sitemap

The root class for sitemapper.Sitemaps.

Inherits from django.contrib.sitemaps.Sitemap and overrides the Sitemap.items() method.

In this class calling items() does two things:

  1. It creates a private attribute _entries containing a dictionary of sitemapper.SitemapEntry objects having the same ContentType as the supplied queryset’s model. This dictionary is keyed to the object_id of each SitemapEntry instance.
  2. It then returns the queryset.

Attributes:

queryset (queryset): A queryset containing the objects to appear in
the sitemap.
_entries (dict): A private variable populated by the items() method and
containing SitemapEntries matching the ContentType and object_id of the queryset above.
items()

Assign the result of _get_entries_for_model(model) to the private attribute _entries, and return the queryset attribute.

class sitemapper.sitemaps.Sitemap

Bases: sitemapper.sitemaps.SitemapBase

changefreq(item)

Return one of three values:

  1. the SitemapEntry.changefreq related to item, if set;
  2. or, the default_changefreq, if set;
  3. or, None
Args:
item (model instance): An member instance of self.queryset.
priority(item)

Return one of three values:

  1. the SitemapEntry.priority related to item, if set;
  2. or, the default_priority, if set;
  3. or, None
Args:
item (model instance): An member instance of self.queryset.

sitemapper.models

class sitemapper.models.SitemapEntry(*args, **kwargs)

SitemapEntry(id, content_type_id, object_id, changefreq, priority)