Package sitemap adjustments

Adjust changefreq and priority based on the repository the package is
in. Testing and staging have quick turnover so set the changefreq to
'daily'. Additionally, give staging packages a super low priority of 0.1
and testing a slightly lowered priority of 0.4.

We didn't include staging packages before, but since search engines are
finding them anyway, we might as well. This gives us a chance to share
how important the page is as well, which they could only guess before.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2013-02-20 18:57:34 -06:00
parent 0491bdb245
commit 1457f78594

View File

@ -11,17 +11,27 @@
class PackagesSitemap(Sitemap):
changefreq = "weekly"
priority = "0.5"
def items(self):
return Package.objects.normal().filter(repo__staging=False).only(
return Package.objects.normal().only(
'pkgname', 'last_update', 'files_last_update',
'repo__name', 'arch__name').order_by()
'repo__name', 'repo__testing', 'repo__staging',
'arch__name').order_by()
def lastmod(self, obj):
return obj.last_update
def changefreq(self, obj):
if obj.repo.testing or obj.repo.staging:
return "daily"
return "weekly"
def priority(self, obj):
if obj.repo.testing:
return "0.4"
if obj.repo.staging:
return "0.1"
return "0.5"
class PackageFilesSitemap(PackagesSitemap):
changefreq = "weekly"