Pocket-E
Jan29

Complete Django Sitemap

Author // scum Categories // Quick Notes

Django's sitemap framework is a fantastic tool for quickly mapping out the bulk of your website.

The tutorial covers in depth how to index object pages, flat pages, and generics pages with ease using this tool... however, the documentation seems to leave you on your own to index those one-off pages, such as your main landing page.

It seems the best way to handle this is to follow the Django "Simple Example" instructions, but in the place of the `items` method, use the content below.

 
class MainSitemap( Sitemap ):
 
  def items(self):
    return [self]
 
  location = "/"
  changefreq = "monthly"
  priority = "1"
 

A class will need to be created for each one-off page, but by definition these should not be crowding your site in the first place.

About the Author