Example #1
0
    def items(self):
        """Return all news articles"""
        return Article.objects.get_published()

    def lastmod(self, obj):
        """When was the article last modified?"""
        # pylint: disable=no-self-use
        return obj.pub_date


class ArticleNewsSitemap(NewsSitemap):
    """Article sitemap for Google News"""
    limit = 500

    def items(self):
        """Return all news articles"""
        return Article.objects.get_published().prefetch_related('tags')

    def lastmod(self, obj):
        """When was the article last modified?"""
        # pylint: disable=no-self-use
        return obj.pub_date

    def keywords(self, obj):
        """Keywords for the article"""
        return ','.join(t.name for t in obj.tags.all())


register(articles=ArticleNewsSitemap)
Example #2
0
from django.conf.urls.defaults import *
from news_sitemaps import register, NewsSitemap

from django.contrib import admin
admin.autodiscover()

from django.contrib.comments.models import Comment

class CommentSitemap(NewsSitemap):
    limit = 5000
    def items(self):
        return Comment.objects.filter(is_public=True,is_removed=False)
        
    def lastmod(self, obj):
        return obj.submit_date
    
    def genres(self, obj):
        return 'UserGenerated, Opinion'
        
register(comments=CommentSitemap)


urlpatterns = patterns('',
    (r'^admin/', include(admin.site.urls)),
    (r'^comments/', include('django.contrib.comments.urls')),
    (r'^news-sitemaps/', include('news_sitemaps.urls')),
)

Example #3
0
from django.contrib import admin

admin.autodiscover()

from django.contrib.comments.models import Comment


class CommentSitemap(NewsSitemap):
    limit = 5000

    def items(self):
        return Comment.objects.filter(is_public=True, is_removed=False)

    def lastmod(self, obj):
        return obj.submit_date

    def genres(self, obj):
        return "UserGenerated, Opinion"


register(comments=CommentSitemap)


urlpatterns = patterns(
    "",
    (r"^admin/", include(admin.site.urls)),
    (r"^comments/", include("django.contrib.comments.urls")),
    (r"^news-sitemaps/", include("news_sitemaps.urls")),
)
Example #4
0
        return Post.objects.published().exclude(staff_blog=True)

    def lastmod(self, obj):
        return obj.publish

    def genres(self, obj):
        return 'Blog'

    def publication_date(self, obj):
        return obj.publish

    def title(self, obj):
        return obj.title


register(blog=NewsSitemap)


class BlogSitemap(RhizomeSitemap):
    def items(self):
        return Post.objects.published()

    def lastmod(self, obj):
        return obj.modified


class DiscussSitemap(RhizomeSitemap):
    def items(self):
        threads = DiscussionThread.objects.filter(is_public=True).exclude(pk=1)
        return [thread for thread in threads if thread.is_discuss_thread()]
Example #5
0
    def items(self):
        return Post.objects.published().exclude(staff_blog=True)

    def lastmod(self, obj):
        return obj.publish

    def genres(self, obj):
        return 'Blog'

    def publication_date(self, obj):
        return obj.publish
        
    def title(self, obj):
        return obj.title

register(blog=NewsSitemap)

class BlogSitemap(RhizomeSitemap):
    def items(self):
        return Post.objects.published()

    def lastmod(self, obj):
        return obj.modified

class DiscussSitemap(RhizomeSitemap):
    def items(self):
        threads = DiscussionThread.objects.filter(is_public=True).exclude(pk=1)
        return [thread for thread in threads if thread.is_discuss_thread()]

    def lastmod(self, obj):
        return obj.last_comment.submit_date