views:

57

answers:

1

I have a site with about 60,000 pages that are getting placed in the sitemap, and which have a priority of 0.3. These are all really long pages that are rich in keywords.

I also have a few pages (like the about page), that need high priority, but which I've implemented with the django flatpages framework.

Is it possible for pages created this way to have a higher priority in the sitemap?

+1  A: 

Yes you can do this but you cannot use the FlatPageSitemap as is since it does not include the priority. You will instead have to write your own. Here on the docs on the sitemap framework: http://docs.djangoproject.com/en/1.1/ref/contrib/sitemaps/

In your custom FlatPageSitemap you would simply override the priority function to return different priorities for your various flatpages. The logic could be based on the page's url or pk.

from django.contrib.sitemaps import FlatPageSitemap

class MyFlatPageSitemap(FlatPageSitemap):
    def priority(self, item):
        # Insert your logic here
Mark Lavin
This looks excellent, and makes complete sense now that you put it out there. I'll try it out, and see what happens, thanks!
mlissner
Thanks, this works well.
mlissner
Code here, for the curious: http://bitbucket.org/mlissner/legal-current-awareness/src/dc66d2268bec/alert/alertSystem/sitemap.py
mlissner
Thanks for the update and the link. I'm glad it worked for you. Honestly I had never really thought about changing the priority for the FlatPages before but I probably should.
Mark Lavin