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

sitemaps.views.index()

views.index(request, sitemaps, template_name='sitemap_index.xml', content_type='application/xml', sitemap_url_name='django.contrib.sitemaps.views.sitemap') The sitemap framework also has the ability to create a sitemap index that references individual sitemap files, one per each section defined in your sitemaps dictionary. The only differences in usage are: You use two views in your URLconf: django.contrib.sitemaps.views.index() and django.contrib.sitemaps.views.sitemap(). The django.contrib

sitemaps.Sitemap.protocol

protocol Optional. This attribute defines the protocol ('http' or 'https') of the URLs in the sitemap. If it isn’t set, the protocol with which the sitemap was requested is used. If the sitemap is built outside the context of a request, the default is 'http'.

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.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.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.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.Sitemap.changefreq

changefreq 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 change frequency as a string. If it’s an attribute, its value should be a string representing the change frequency of every object returned by items(). Possible values for changefreq, whether you use a method or attribute, are: 'always' 'hourly' 'daily' 'weekly' 'monthly' 'yearly' 'never'