Skip to content Skip to sidebar Skip to footer

Priority Issue In Sitemaps

I am trying to use Django sitemaps. class BlogSiteMap(Sitemap): '''A simple class to get sitemaps for blog''' changefreq = 'hourly' priority = 0.5 def items(self

Solution 1:

I think you can alter each object with its priority. Like that for example:

defitems(self):
    for i, obj in enumerate(Blog.objects.order_by('-pubDate')):
       obj.priority = i < 3and1or0.5yield obj

defpriority(self, obj):
    return obj.priority

Solution 2:

Something like that might work:

defpriority(self, obj):
    if obj.idinlist(Blog.objects.all()[:3].values_list('id'))
        return1.0else:
        return0.5

Post a Comment for "Priority Issue In Sitemaps"