Django Sitemap Framework integriert

This commit is contained in:
2016-10-11 23:54:18 +02:00
parent 8595959872
commit ba44e97e9a
20 changed files with 249 additions and 176 deletions

25
src/content/sitemaps.py Normal file
View File

@@ -0,0 +1,25 @@
from django.contrib.sitemaps import Sitemap
from .models import Article, Page
class ArticleSitemap(Sitemap):
changefreq = "never"
priority = 0.6
protocol = 'https'
def items(self):
return Article.objects.published()
def lastmod(self, article):
return article.date_modified
class PageSitemap(Sitemap):
changefreq = "monthly"
priority = 0.4
protocol = 'https'
def items(self):
return Page.objects.all() #filter(status__gt=0)
def location(self, page):
return page.get_absolute_url()