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 8923409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:06:35+00:00 2026-06-15T07:06:35+00:00

I created sitemap for my website in Django as below sitemap class MyModelSitemap(Sitemap): changefreq

  • 0

I created sitemap for my website in Django as below

sitemap

class MyModelSitemap(Sitemap):
    changefreq = "daily"
    priority = 0.5

    def items(self):
        return MyModel.objects.all()

    def lastmod(self, obj):
        return datetime.datetime.today()

urls.py

sitemaps = {
    'mymodel': MyModelSitemap,
    }

get_absolute_link() is also implemented for MyModel

The problem there are many other URLs that uses MyModel so it’s not possible to have only one absolute_link for it.

I need to provide many other URLs to sitemap depending on different queries of MyModel.

How can I achieve this?

  • 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-06-15T07:06:37+00:00Added an answer on June 15, 2026 at 7:06 am

    The easy way is to create additional sitemaps:

    class MyModelAdditionalLinkSitemap(MyModelSitemap):
        def location(self, obj):
            return obj.get_additional_link()
    

    urls.py

    sitemaps = {
        'mymodel': MyModelSitemap,
        'mymodel2': MyModelAdditionalLinkSitemap
    }
    

    Added:

    I you want to use just one Sitemap class, try something like:

    import itertools
    
    class MyModelSitemap(Sitemap):
        changefreq = "daily"
        priority = 0.5
    
        def items(self):
            product = itertools.product(MyModel.objects.all(), xrange(2))
            return list(product)
    
        def location(self, obj):
            if (obj[1] == 1):
                return obj[0].get_additional_link()
            return obj[0].get_absolute_link()
    
        def lastmod(self, obj):
            return datetime.datetime.today()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm created a sitemap for a website I'm developing and I'm having some trouble
How do you create a sitemap for ASP.NET MVC website which can appear on
I have created a sitemap for my site and it complies with the protocol
Created Private Key & Self signed certficate in a Key Store keytool -genkey -alias
I am writing a set of functions to generate a sitemap for a website.
i created a site map with the name Web.sitemap in the root folder, and
I'm using playframework v2 and I have my sitemap files being re-created once a
I created a class which inherits from SiteMapNode and overrode the Title property of
I need to create a sitemap for my website to submit to search engines
I have created an ajax driven website which can load any page when given

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.