Opened 14 years ago

Closed 13 years ago

#13908 closed Bug (duplicate)

contrib.sitemaps.view.index doesn't work in more than one location

Reported by: palewire Owned by: nobody
Component: contrib.sitemaps Version: dev
Severity: Normal Keywords: sitemaps index pagination xml
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The sitemaps app doesn't seem to allow "index" sitemaps with pagination in more than one location. For instance, if two different apps try to create an index site at two different urls, one set of urls will overwrite the other. I've created a demonstration app that shows the problem on Github. You can find it here. http://github.com/palewire/django-sitemaps-index-bug

Maybe it's a dumb idea to have two different sitemaps like that, but I'm not sure it's the intention of the app to act that way. If there's a way to override things and sort it out, allow me to apologize in advance.

Attachments (1)

patch.diff (1.0 KB ) - added by palewire 14 years ago.
Add optional kwarg for 'section_urlname'

Download all attachments as: .zip

Change History (8)

by palewire, 14 years ago

Attachment: patch.diff added

Add optional kwarg for 'section_urlname'

comment:1 by palewire, 14 years ago

Has patch: set
Version: 1.1SVN

I just added a patch that adds and optional kwarg where you can override the urlname that the view now reverses by default. So, if you wanted to use multiple index+section combinations across your site, you could pull it off by adding that kwarg to your index url. Like so:

from app1.sitemaps import FakeSitemap
from django.conf.urls.defaults import *


# Sitemaps
sitemaps = {
    'fake': FakeSitemap,
}

urlpatterns = patterns('django.contrib.sitemaps.views',
    url(r'^sitemap\.xml$', 'index', {
        'sitemaps': sitemaps,
        'section_urlname': 'app1-sitemap-section',
        }, name='app1-sitemap'),

    url(r'^sitemap-(?P<section>.+)\.xml$', 'sitemap', {
        'sitemaps': sitemaps
        }, name='app1-sitemap-section'),
)

comment:2 by Mark Lavin, 14 years ago

Needs documentation: set
Needs tests: set
Owner: changed from nobody to Mark Lavin
Status: newassigned

I have verified the issue (using [13713]) from the sample project . I would say this is a valid bug as the sitemaps specification clearly states that you can have more than one sitemap index: http://www.sitemaps.org/protocol.php#index

If you do provide multiple Sitemaps, you should then list each Sitemap file in a Sitemap index file. 
Sitemap index files may not list more than 50,000 Sitemaps and must be no larger than 10MB (10,485,760 bytes) and can be compressed. 
You can have more than one Sitemap index file. The XML format of a Sitemap index file is very similar to the XML format of a Sitemap file.

However this patch needs some work. There are no tests and the new keyword argument is undocumented.

comment:3 by Mark Lavin, 14 years ago

Owner: changed from Mark Lavin to nobody
Status: assignednew
Triage Stage: UnreviewedAccepted

comment:4 by Gabriel Hurley, 14 years ago

Component: Contrib appscontrib.sitemaps

comment:5 by Graham King, 14 years ago

Severity: Normal
Type: Bug

comment:6 by Jannis Leidel, 13 years ago

Easy pickings: unset
UI/UX: unset

Duplicate of #2713.

comment:7 by Jannis Leidel, 13 years ago

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top