sitemaps.views.sitemap()

views.sitemap(request, sitemaps, section=None, template_name='sitemap.xml', content_type='application/xml') To activate sitemap generation on your Django site, add this line to your URLconf: from django.contrib.sitemaps.views import sitemap url(r'^sitemap\.xml$', sitemap, {'sitemaps': sitemaps}, name='django.contrib.sitemaps.views.sitemap') 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. Searc

sites.middleware.CurrentSiteMiddleware

class CurrentSiteMiddleware [source] Adds the site attribute representing the current site to every incoming HttpRequest object. See the sites documentation.

sites.models.Site

class models.Site A model for storing the domain and name attributes of a website. domain The fully qualified domain name associated with the website. For example, www.example.com. Changed in Django 1.9: The domain field was set to be unique. name A human-readable “verbose” name for the website. The SITE_ID setting specifies the database ID of the Site object associated with that particular settings file. If the setting is omitted, the get_current_site() function will try to ge

sitemaps.Sitemap.priority

priority Optional. Either a method or attribute. If it’s a method, it should take one argument – an object as returned by items() – and return that object’s priority as either a string or float. If it’s an attribute, its value should be either a string or float representing the priority of every object returned by items(). Example values for priority: 0.4, 1.0. The default priority of a page is 0.5. See the sitemaps.org documentation for more.

sitemaps.Sitemap.limit

limit Optional. This attribute defines the maximum number of URLs included on each page of the sitemap. Its value should not exceed the default value of 50000, which is the upper limit allowed in the Sitemaps protocol.

sitemaps.Sitemap.lastmod

lastmod Optional. Either a method or attribute. If it’s a method, it should take one argument – an object as returned by items() – and return that object’s last-modified date/time as a datetime. If it’s an attribute, its value should be a datetime representing the last-modified date/time for every object returned by items(). If all items in a sitemap have a lastmod, the sitemap generated by views.sitemap() will have a Last-Modified header equal to the latest lastmod. You can activate the Con

sitemaps.Sitemap.items

items [source] Required. A method that returns a list of objects. The framework doesn’t care what type of objects they are; all that matters is that these objects get passed to the location(), lastmod(), changefreq() and priority() methods.

sitemaps.Sitemap.location

location [source] Optional. Either a method or attribute. If it’s a method, it should return the absolute path for a given object as returned by items(). If it’s an attribute, its value should be a string representing an absolute path to use for every object returned by items(). In both cases, “absolute path” means a URL that doesn’t include the protocol or domain. Examples: Good: '/foo/bar/' Bad: 'example.com/foo/bar/' Bad: 'https://example.com/foo/bar/' If location isn’t provided, the

sitemaps.Sitemap.i18n

i18n Optional. A boolean attribute that defines if the URLs of this sitemap should be generated using all of your LANGUAGES. The default is False.

sitemaps.ping_google()

ping_google() [source] ping_google() takes an optional argument, sitemap_url, which should be the absolute path to your site’s sitemap (e.g., '/sitemap.xml'). If this argument isn’t provided, ping_google() will attempt to figure out your sitemap by performing a reverse looking in your URLconf. ping_google() raises the exception django.contrib.sitemaps.SitemapNotFound if it cannot determine your sitemap URL. Register with Google first! The ping_google() command only works if you have registe