blob: 5e5862a4094111834260fd3536571c7958376410 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
from django.contrib.sitemaps import Sitemap
from .models import Entry
class WeblogSitemap(Sitemap):
changefreq = "never"
priority = 0.4
def items(self):
return Entry.objects.published()
def _urls(self, page, site, protocol):
# XXX: To workaround bad interaction between contrib.sitemaps and
# django-hosts (scheme/domain would be repeated twice in URLs)
urls = []
for item in self.paginator.page(page).object_list:
loc = item.get_absolute_url()
url_info = {
"item": item,
"location": loc,
}
urls.append(url_info)
return urls
# lastmod wasn't implemented, because weblog pages used to contain comments.
|