You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this feature affect backwards compatibility? If yes, in what way?
No.
With Nikola 8.3.1, a link like link://slug/my-post?lang=de causes Nikola to abort because lang (None or not) is already passed as a positional param:
TypeError: Nikola.path() got multiple values for argument 'lang'
So I guess it is backwards compatible.
As for link://filename/my-post.other_lang.md, it produces invalid urls half of the time. And I think fixing it is not a breaking change.
Rationale and full description
Currently, many magic links in Nikola (slugs, filenames, etc.) cannot link across languages. (If I understand correctly, the only one that seems to support this is link:///absolute-path.)
Since the _link function in templates has an optional lang param, it would be natural to allow using a lang query param in links, like: link://slug/my-post?lang=de.
Even if the user tries to link with absolute filenames via link://filename/..., with SHOW_UNTRANSLATED_POSTS = False, Nikola will produce invalid links, because it uses the current language in filename_path when calling p.permalink:
Requested Feature
lang
query param like:link://slug/my-post?lang=de
.filename
links like:link://filename/my-post.other_lang.md
.Related Area
(I don't know. I guess it's related to the core
nikola.py
.)Do you want to contribute this yourself as a pull request?
Does this feature affect backwards compatibility? If yes, in what way?
No.
link://slug/my-post?lang=de
causes Nikola to abort becauselang
(None or not) is already passed as a positional param:link://filename/my-post.other_lang.md
, it produces invalid urls half of the time. And I think fixing it is not a breaking change.Rationale and full description
Currently, many magic links in Nikola (slugs, filenames, etc.) cannot link across languages. (If I understand correctly, the only one that seems to support this is
link:///absolute-path
.)Since the
_link
function in templates has an optionallang
param, it would be natural to allow using alang
query param in links, like:link://slug/my-post?lang=de
.A typical use case for this may be How to use translated slugs/URLs on a multi-language site? #3801 when the user want to link to posts in another language without having to hardcode links.
Even if the user tries to link with absolute filenames via
link://filename/...
, withSHOW_UNTRANSLATED_POSTS = False
, Nikola will produce invalid links, because it uses the current language infilename_path
when callingp.permalink
:nikola/nikola/nikola.py
Lines 1970 to 1976 in 1da7205
The text was updated successfully, but these errors were encountered: