Opened 7 years ago

Closed 5 years ago

#10907 closed New feature (fixed)

Adding google news sitemap support to django.contrib.sitemaps

Reported by: lakinwecker Owned by: lakinwecker
Component: contrib.sitemaps Version: 1.0
Severity: Normal Keywords:
Cc: msimoens Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Google News Sitemaps are very similar to normal sitemaps in that they build off of the sitemaps protocol. They add a new namespace to the xml file, along with some added news-specific attributes to eatch url.

This patch adds support for generation of these news sitemaps to the django.contrib.sitemaps application.

There were no tests for this package - so I have not added any news tests. I have however, made an attempt to update the documentation for sitemaps.

Attachments (1)

news_sitemaps.diff (9.8 KB) - added by lakinwecker 7 years ago.
Fixed the bugs.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 7 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

It looks like you left a bit of hard-coded data on line 14 of django/contrib/sitemaps/templates/news_sitemap.xml

{% if url.keywords %}<news:keywords>Business, Mergers, Acquisitions</news:keywords>{% endif %} 

comment:2 Changed 7 years ago by msimoens

  • Cc msimoens added

comment:3 Changed 7 years ago by lakinwecker

  • Owner changed from nobody to lakinwecker
  • Status changed from new to assigned

There are a couple of small bugs that i discovered this morning - working through those now.

Changed 7 years ago by lakinwecker

Fixed the bugs.

comment:4 Changed 7 years ago by lakinwecker

Ok, those bugs have been ferretted out.

comment:5 Changed 7 years ago by Alex

  • Triage Stage changed from Unreviewed to Design decision needed

comment:6 Changed 7 years ago by ChrisL

Ticket patch not updated.

I'm implementing this patch and can see the <news:keywords> content is still in place. Should read:

{% if url.keywords %}<news:keywords>

{% for keyword in keywords %}{{ url.keyword }}{% if not forloop.last %}, {% endif %}{% endfor %}

</news:keywords>{% endif %}

can't get the news sitemap content to pass through to the template correctly, likely this was part of the bugs that were cleaned up?

Please post the up to date patch.

comment:7 Changed 7 years ago by Timothée Peignier <timothee.peignier@…>

There also a mobile sitemap format existing, see :

comment:8 Changed 5 years ago by gabrielhurley

  • Component changed from Contrib apps to contrib.sitemaps

comment:9 Changed 5 years ago by SmileyChris

  • Severity set to Normal
  • Type set to New feature

comment:10 Changed 5 years ago by jezdez

  • Resolution set to fixed
  • Status changed from assigned to closed

In [16474]:

Fixed #10907, #14190 and #15829 -- Pass item to sitemaps template to allow further customization like Google News enabled sitemaps. Thanks, manfre and lakinwecker.

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