sitemap.py
from django.contrib.sitemaps import FlatPageSitemap
class MyFlatPageSitemap(FlatPageSitemap):
def priority(self, item):
if 'about' in str(item.get_absolute_url).lower():
return 0.8
if 'clients' in str(item.get_absolute_url).lower():
return 0.3
if 'services' in str(item.get_absolute_url).lower():
return 0.8
else:
return 0.2
def changefreq(self, obj):
return "weekly"
urls.py
from django.contrib.sitemaps import FlatPageSitemap, GenericSitemap
from sitemap import *
sitemaps = {
#'flatpages': FlatPageSitemap,
'flatpages': MyFlatPageSitemap,
}
urlpatterns = patterns('',
(r'^sitemap\.xml', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
)
Немає коментарів:
Дописати коментар