Django Sitemap Framework integriert
This commit is contained in:
25
src/content/sitemaps.py
Normal file
25
src/content/sitemaps.py
Normal 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()
|
||||
Reference in New Issue
Block a user