Sitemaps for page that should be public viewable
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user