Opened 8 years ago
Last modified 4 years ago
#27395 closed New feature
Allow generating '<link rel="alternate ... hreflang=...>" for sitemaps' — at Version 5
Reported by: | Hovi | Owned by: | nobody |
---|---|---|---|
Component: | contrib.sitemaps | Version: | 1.10 |
Severity: | Normal | Keywords: | |
Cc: | Hendy Irawan | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Hello,
django sitemap supports i18n field, that enables generating language-aware sitemaps, here is doc:
https://docs.djangoproject.com/en/1.10/ref/contrib/sitemaps/#django.contrib.sitemaps.Sitemap.i18n
Problem is, that it generates them just as each url separately with no relations. One of google recommendations is to mark same content in different languages using sitemap with xhtml:link element:
https://support.google.com/webmasters/answer/189077
https://support.google.com/webmasters/answer/2620865
Would be cool to add possibility to generate these tags.
Change History (6)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Both ways actually make sense (in html page and sitemap) and code generating it in both cases would be very similar, but to answer your original question - this involves changes to sitemap itself yes.
comment:3 by , 8 years ago
Summary: | Django sitemap and i18n → Allow generating '<link rel="alternate ... hreflang=...>" for sitemaps' |
---|---|
Triage Stage: | Unreviewed → Accepted |
What are those changes? Are you able to offer a patch?
comment:4 by , 8 years ago
I included simple patch to demonstrate what would require changing, by no means it's supposed to be final. There may be a little more work to avoid duplicities, but it does pretty much everything necessary.
comment:5 by , 8 years ago
Description: | modified (diff) |
---|
Is the idea to add something like a template tag that generates something like:
for use on a webpage? (If so, I'm not familiar enough with sitemaps code to say whether or not it's feasible.) Or does this involve some change to the sitemap itself?