#16829: sitemap for static views
---------------------------+----------------------------------
Reporter: madisv | Owner: nobody
Type: New feature | Status: new
Milestone: 1.4 | Component: contrib.sitemaps
Version: 1.3 | Severity: Normal
Keywords: views sitemap | Triage Stage: Unreviewed
Has patch: 1 | Easy pickings: 0
UI/UX: 0 |
---------------------------+----------------------------------
People also use static views which are not FlatPages. So it's a problem
creating a sitemap for such urls.
This is not hard to do if you know how so should this code maybe also be
in django or might we just document this so people would know how to do
this.
Problem explained also:
http://stackoverflow.com/questions/4836188/django-sitemaps-and-normal-
views
Solution by Matt Austin:
from django.core.urlresolvers import reverse
from django.contrib.sitemaps import Sitemap
{{{
class ViewSitemap(Sitemap):
"""Reverse static views for XML sitemap."""
def items(self):
# Return list of url names for views to include in sitemap
return ['homepage', 'news_article_list', 'contact_page']
def location(self, item):
return reverse(item)
sitemaps = {'views': ViewSitemap, 'news_articles': ArticleSitemap}
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/16829>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.