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:
- 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.
- 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:
- the SitemapEntry.changefreq related to item, if set;
- or, the default_changefreq, if set;
- or, None
- Args:
- item (model instance): An member instance of self.queryset.
- priority(item)¶
Return one of three values:
- the SitemapEntry.priority related to item, if set;
- or, the default_priority, if set;
- or, None
- Args:
- item (model instance): An member instance of self.queryset.