, . , , .
, django.contrib.sitemaps.Sitemap URL- . - :
class StaticSitemap(Sitemap):
priority = 0.8
lastmod = datetime.datetime.now()
def __init__(self, filename):
self._urls = []
try:
f = open(filename, 'rb')
except:
return
tmp = []
for x in f:
x = re.sub(r"\s*#.*$", '', x)
if re.match('^\s*$', x):
continue
x = string.strip(x)
x = re.sub(' ', '%20', x)
if not x.startswith('/'):
x = '/' + x
tmp.append(x)
f.close()
self._urls = tmp
def items(self):
return self._urls
def location(self, obj):
return obj
- Sitemap:
sitemap['static'] = StaticSitemap(settings.DIR_ROOT +'/sitemap.txt')
sitemap.txt :
/tour/
/podcast_archive/
/related_sites/
/survey/
/youtube_videos/
/teachers/
/workshops/
/workshop_listing_info/
/aboutus/
/history/
/investment/
/business/
/contact/
/privacy_policy/
/graphic_specs/
/help_desk/