Ensure link path to be URL encoded #2005
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.
All URLs in Nikola are already compiling with “RFC-3986 standard for URIs, the RFC-3987 standard for IRIs, and the XML standard.” (sitemap FAQ).
Nikola uses the same URL fromat in the sitemap as well as for link canonicalization so there is no confusion in the terms of search engines and duplicate content. So the SEO argument is something I wouldn’t worry about at all in this case. (And I’m usually the SEO worrying type.) We’re already following best-practices. I’m not sure if any particular servers would do better with one format over the other. This is the only possible argument for changing this. This would have ether be a problem everyone or no one, so there should be no need for an option to optionally break URLs.
From the attached screenshot, everything part of the browser (and Nikola) seem to be doing the correct thing. In summary, besides
Maybe I’m misunderstand the issues here. I believe we already do use RFC-3986 / RFC-3987 (plus XML reserved-characters escaping) everywhere. If this is not the case, than things are broken and should be fixed and made non-optional. Updating these links should be done internally and not require any changes to any templates.
@masayuko, is Nikola not meeting RFC-3986 / RFC-3987 everywhere? nowhere? somewhere? what about sitemaps? atom/rss? If not, the link utilities that produced the links should be considered broken and need fixing. The link issue should not require template changes at all as Nikola should already be producing standard links.
We could add a new method
The attached screenshot means the follow process is occured:
I hope the below part:
The following method should produce correctly encoded links for anything that Nikola produces. (Limited to netloc and paths, because that’s all that Nikola controls.) I’ll make a new branch, stick this in
Opinions? @Kwpolska? @masayuko?
Some examples, all producing the expected result. Why a method fulfilling this purpose isn’t already provided by