1π
β
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()
π€vvd
Source:stackexchange.com