Sitemaps for page that should be public viewable

This commit is contained in:
2017-11-03 07:16:47 +01:00
parent d5b67ffe0c
commit 7c08ead392
8 changed files with 72 additions and 3210 deletions

View File

@@ -1,31 +1,23 @@
"""Add News and static pages to the global sitemap."""
from django.contrib.sitemaps import Sitemap
from kasu.sitemaps import GenericSitemap
from .models import Article, Page
class ArticleSitemap(Sitemap):
"""Add the news artivles to the Sitemap"""
changefreq = "never"
priority = 0.6
class ArticleSitemap(GenericSitemap):
"""Add all published news articles to the Sitemap."""
min_priority = 0.25
def items(self):
@staticmethod
def items():
"""only add published articles to the sitemap"""
return Article.objects.published()
def lastmod(self, article):
"""return the last modification date of the article."""
return article.date_modified
class PageSitemap(Sitemap):
class PageSitemap(GenericSitemap):
"""add the static pages to the sitemap."""
changefreq = "monthly"
priority = 0.4
min_priority = 0.5
def items(self):
@staticmethod
def items():
"""add all pages to the sitemap."""
return Page.objects.all()
def lastmod(self, page):
"""return the last modification date of the page."""
return page.date_modified