Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#2805 closed enhancement (fixed)

[patch] make sitemaps more space effective

Reported by: Maximillian dornseif <md@…> Owned by: Adrian Holovaty
Component: Contrib apps Version: 0.95
Severity: trivial Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The XML generates by sitemaps contains lot of whitespace. Since sitemaps are meant to be only processed by machines and the templates are only seldom edited by humans it makes sense to strip out most unneeded whitespace. Basically this is a readability bandwidth tradeoff. This patch changes the sitemaps framework to use the same approach as the syndication framework: prefer bandwidth over readability. It reduced the size of my sitemap by about 20 %.

Get the Patch at http://c0re.23.nu/c0de/misc/django-3810-sitemap_space_saver.diff

Attachments (1)

django-3810-sitemap_space_saver.diff.txt (1.6 KB) - added by md@… 10 years ago.

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by md@…

comment:1 Changed 10 years ago by Adrian Holovaty

Readability of XML is not important, but readability of templates *is* important. A good solution could be to use the {% spaceless %} template tag to strip the space on output. I'll check in that change momentarily.

Also note that if you're super concerned about bandwidth, just use gzip for your sitemap. See the djangoproject.com URLconf for an example of how to do that.

comment:2 Changed 10 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

(In [3869]) Fixed #2805 -- Removed some whitespace from the two sitemap XML templates.

Note: See TracTickets for help on using tickets.
Back to Top