divio/django-cms — pull request #1557 by mihaisucan (2012-12-12 13:50:52+00:00)
Title: improve support for multilanguage sitemaps

Working on a multilanguage web site and I needed a `sitemap.xml` that includes correct URLs for each page, in each language.

Currently `django-cms` generates URLs without any language prefix, even if I have the multilanguage URL middleware enabled. It also includes all pages at once, but I get the slugs in only one language (the current site language). So it's all a mix up: English-only pages end up getting French slugs and so on.

This pull request does the following:
* `CMSSitemap` only includes URLs for the current site language, by default. If I am not mistaken, this allows you to serve multiple language-specific `sitemap.xml` files - just point to `/en/sitemap.xml`, or `/other-language/sitemap.xml` from `robots.txt` and make sure you correctly setup your `urls.py`.
* I included a fix for `Title.objects.public()` which doesn't seem to work.
* Included a new `sitemaps/utils.py` that people can use to generate a single `sitemap.xml` with all the pages in all languages. Example:

```python
from cms.sitemaps import CMSSitemap
from cms.sitemaps.utils import MakeMultilanguageSitemap
sitemaps = { 'sitemaps': MakeMultilanguageSitemap({
'cmspages': CMSSitemap,
}),}
```

I use this to generate correct URLs for all multilanguage pages and apps. This utility function works for me with other sitemap classes as well.

Please let me know if further changes are needed. Thank you!