Opened 15 years ago
Closed 14 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)
Change History (8)
by , 15 years ago
| Attachment: | patch.diff added |
|---|
comment:1 by , 15 years ago
| Has patch: | set |
|---|---|
| Version: | 1.1 → SVN |
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 , 15 years ago
| Needs documentation: | set |
|---|---|
| Needs tests: | set |
| Owner: | changed from to |
| Status: | new → assigned |
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 , 15 years ago
| Owner: | changed from to |
|---|---|
| Status: | assigned → new |
| Triage Stage: | Unreviewed → Accepted |
comment:4 by , 15 years ago
| Component: | Contrib apps → contrib.sitemaps |
|---|
comment:5 by , 15 years ago
| Severity: | → Normal |
|---|---|
| Type: | → Bug |
comment:7 by , 14 years ago
| Resolution: | → duplicate |
|---|---|
| Status: | new → closed |
Add optional kwarg for 'section_urlname'