-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SitemapBuildableView #48
Add SitemapBuildableView #48
Conversation
> Invalid HTTP_HOST header: 'site_2'. The domain name provided is not valid according to RFC 1034/1035.
Based on WagtailBakeryView's request
Currently, sitemaps are build at the correct location for single and multisites, however the content is incorrect for multisites. Despite creating a request which is multisites aware, and that request being passed to the Sitemap object, it then use the paginator which doesn't seem to be multisite aware and return pages of the default site. There's I'll leave this aside for a bit so I can focus on releasing a new version of the package and then come back to this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @loicteixeira, looks good!
We'll need some basic documentation, e.g. in the Configuration
section of the README.
|
||
|
||
class SitemapBuildableView(BuildableMixin): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a comment to explain the function of this view?
view.request = view.create_request(view.sitemap_path) | ||
|
||
content = view.get_content().decode() | ||
expected_content = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test looks fragile. Should we assume that the exact formatting of Django's sitemap generation will be consistent across versions? As an alternative we could parse the XML and check for the namespace, a single <loc>
element inside a single <url>
element etc.
Rebase & continue #38. Fix #37.