Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 941413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:06:56+00:00 2026-05-15T22:06:56+00:00

I have some doubts regarding sitemap.xml generation and Django’s sitemap framework particularly. Let’s say

  • 0

I have some doubts regarding sitemap.xml generation and Django’s sitemap framework particularly.

Let’s say I have a blog application which has post_detail pages with each post’s content and a bunch of ‘helper’ pages like ‘view by tag’, ‘view by author’, etc.

  1. Is it mandatory to include each and every page in sitemap.xml, including ‘helper’ pages? I want all of ‘helper’ pages indexed as there are many keywords and text. I know that sitemaps are designed to help index pages, to give some directions to web-crawler, but not to limit crawling. What is the best practice for that? Include everything or include only important pages?
  2. If it’s okay to have all of the pages in sitemap.xml, what is the best way to submit plain, not-stored in db pages to sitemaps framework? One possible way is to have a sitemap class which returns reversed urls by url name. But it doesn’t seem to be DRY at all, because I’ll gonna need to register those url-names for the second time (in url() function and in Sitemap class).

I could probably have a custom django.conf.urls.defaults.url function to register url-mapping for the sitemap… What do you think?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:06:56+00:00Added an answer on May 15, 2026 at 10:06 pm

    How a sitemap is used is dictated by the search engine. Some will only index what you have in the sitemap, while others will use it as a starting point and crawl the entire site based on cross-linking.

    As for including non-generated pages, we just created a subclass of django.contrib.sitemaps.Sitemap and have it read a plain-text file with one URL per line. Something like:

    class StaticSitemap(Sitemap):
        priority = 0.8
        lastmod = datetime.datetime.now()
    
        def __init__(self, filename):
            self._urls = []
            try:
                f = open(filename, 'rb')
            except:
                return
    
            tmp = []
            for x in f:
                x = re.sub(r"\s*#.*$", '', x) # strip comments
                if re.match('^\s*$', x):
                    continue # ignore blank lines
                x = string.strip(x) # clean leading/trailing whitespace
                x = re.sub(' ', '%20', x) # convert spaces
                if not x.startswith('/'):
                    x = '/' + x
                tmp.append(x)
            f.close()
            self._urls = tmp
        # __init__
    
        def items(self):
            return self._urls
    
        def location(self, obj):
            return obj
    

    You can invoke it with something like this in your main sitemap routine:

    sitemap['static'] = StaticSitemap(settings.DIR_ROOT +'/sitemap.txt')
    

    And our sitemap.txt file looks something like this:

    # One URL per line.
    # All paths start from root - i.e., with a leading /
    # Blank lines are OK.
    
    /tour/
    /podcast_archive/
    /related_sites/
    /survey/
    /youtube_videos/
    
    /teachers/
    /workshops/
    /workshop_listing_info/
    
    /aboutus/
    /history/
    /investment/
    /business/
    /contact/
    /privacy_policy/
    /graphic_specs/
    /help_desk/
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some UI in VB 2005 that looks great in XP Style, but
I have some ASP.NET web services which all share a common helper class they
I have some code for starting a thread on the .NET CF 2.0: ThreadStart
We have some input data that sometimes appears with &nbsp characters on the end.
I have some classes layed out like this class A { public virtual void
I have some C# / asp.net code I inherited which has a textbox which
I have some code like this in a winforms app I was writing to
I have some kind of test data and want to create a unit test
We have some files on our website that users of our software can download.
I have some strings of xxh:yym format where xx is hours and yy is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.