Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you really wanted to do this you would need to extend <code>django.contrib.sitemaps.Sitemap.get_urls</code> to add the additional meta information to the <code>url_info</code> dictionary. The current <code>get_urls</code> is given below from <a href="http://code.djangoproject.com/browser/django/trunk/django/contrib/sitemaps/__init__.py" rel="nofollow">django.contrib.sitemaps</a>:</p> <pre><code>def get_urls(self, page=1, site=None): if site is None: if Site._meta.installed: try: site = Site.objects.get_current() except Site.DoesNotExist: pass if site is None: raise ImproperlyConfigured("In order to use Sitemaps you must either use the sites framework or pass in a Site or RequestSite object in your view code.") urls = [] for item in self.paginator.page(page).object_list: loc = "http://%s%s" % (site.domain, self.__get('location', item)) priority = self.__get('priority', item, None) url_info = { 'location': loc, 'lastmod': self.__get('lastmod', item, None), 'changefreq': self.__get('changefreq', item, None), 'priority': str(priority is not None and priority or '') } urls.append(url_info) return urls </code></pre> <p>After that you would need to change <a href="http://code.djangoproject.com/browser/django/trunk/django/contrib/sitemaps/templates/sitemap.xml" rel="nofollow"><code>django/contrib/sitemaps/templates/sitemap.xml</code></a> to include your extra information in the sitemap. Unrelated to Django if you are adding extra meta information you should read up on the sitemaps.org protocol section regarding <a href="http://sitemaps.org/protocol.php#extending" rel="nofollow">extending the protocol</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload