2010-08-27 23:16:04 +08:00
|
|
|
from datetime import datetime
|
|
|
|
from django.conf.urls.defaults import *
|
2010-09-11 07:30:46 +08:00
|
|
|
from django.contrib.sitemaps import Sitemap, GenericSitemap, FlatPageSitemap
|
2010-08-30 23:09:12 +08:00
|
|
|
from django.contrib.auth.models import User
|
2010-08-27 23:16:04 +08:00
|
|
|
|
|
|
|
class SimpleSitemap(Sitemap):
|
|
|
|
changefreq = "never"
|
|
|
|
priority = 0.5
|
2010-08-30 23:09:12 +08:00
|
|
|
location = '/location/'
|
2010-08-27 23:16:04 +08:00
|
|
|
lastmod = datetime.now()
|
|
|
|
|
|
|
|
def items(self):
|
|
|
|
return [object()]
|
|
|
|
|
2010-08-30 23:09:12 +08:00
|
|
|
simple_sitemaps = {
|
2010-08-27 23:16:04 +08:00
|
|
|
'simple': SimpleSitemap,
|
|
|
|
}
|
|
|
|
|
2010-08-30 23:09:12 +08:00
|
|
|
generic_sitemaps = {
|
|
|
|
'generic': GenericSitemap({
|
|
|
|
'queryset': User.objects.all()
|
|
|
|
}),
|
|
|
|
}
|
|
|
|
|
2010-09-11 07:30:46 +08:00
|
|
|
flatpage_sitemaps = {
|
|
|
|
'flatpages': FlatPageSitemap,
|
|
|
|
}
|
|
|
|
|
2010-08-27 23:16:04 +08:00
|
|
|
urlpatterns = patterns('django.contrib.sitemaps.views',
|
2010-12-13 06:56:29 +08:00
|
|
|
(r'^simple/index\.xml$', 'index', {'sitemaps': simple_sitemaps}),
|
|
|
|
(r'^simple/custom-index\.xml$', 'index', {'sitemaps': simple_sitemaps, 'template_name': 'custom_sitemap_index.xml'}),
|
|
|
|
(r'^simple/sitemap-(?P<section>.+)\.xml$', 'sitemap', {'sitemaps': simple_sitemaps}),
|
2010-08-30 23:09:12 +08:00
|
|
|
(r'^simple/sitemap\.xml$', 'sitemap', {'sitemaps': simple_sitemaps}),
|
2010-12-13 06:56:29 +08:00
|
|
|
(r'^simple/custom-sitemap\.xml$', 'sitemap', {'sitemaps': simple_sitemaps, 'template_name': 'custom_sitemap.xml'}),
|
2010-08-30 23:09:12 +08:00
|
|
|
(r'^generic/sitemap\.xml$', 'sitemap', {'sitemaps': generic_sitemaps}),
|
2010-09-11 07:30:46 +08:00
|
|
|
(r'^flatpages/sitemap\.xml$', 'sitemap', {'sitemaps': flatpage_sitemaps}),
|
2010-08-27 23:16:04 +08:00
|
|
|
)
|