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

  • SEARCH
  • Home
  • 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
  • 4 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 doubts regarding In-Application-Billing in android: Can i test it with different
I have some doubts regarding service hosting in WCF. I want to host a
i'm writing my first plugin for wordpress and i have some doubts regarding the
I have some doubts regarding Strings Are they live on Heap or String pool?
I have some doubts regarding the software licensing model. Recently, while building a small
I am very new to the web development area. I have some doubts regarding
I am new to Django. I have some doubts about installing 3rd party Apps
I have some doubts regarding the following controller action (in ASP.NET MVC, but it's
I have some doubts regarding concurrency of posix threads in multiprocessor machine. I have
I have some doubts/questions regarding the object creation. I have heard that objects should

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.