When I want to add pages to my Header Menu, there is the option 'Header Order' in the edit pages form.
But I realized, that the language code is not included in the generated URLs.
So if I am in my-site/fr, it changes to my-site/pages/page_name instead of my-site/fr/pages/page_name.
This seems not to be optimal for an multilingual website.
Would it make sense to change the url generation code?
I tried it for a bit and changed the code in the plugin.py
in line 54 in the build_pages_nav_main(*args) function
from:
link = tk.h.literal(u'<a href="/{}/{}">{}</a>'.format(type_, name, title))
to:
from ckan.lib.helpers import lang
...
current_lang = lang()
link = tk.h.literal(u'<a href="/{}/{}/{}">{}</a>'.format(current_lang, type_, name, title))
so that the language code is part of the url.
My Code snippet is not optimal, because it always adds the language code, even if it is the default language.
When I want to add pages to my Header Menu, there is the option 'Header Order' in the edit pages form. But I realized, that the language code is not included in the generated URLs. So if I am in
my-site/fr
, it changes tomy-site/pages/page_name
instead ofmy-site/fr/pages/page_name
. This seems not to be optimal for an multilingual website.Would it make sense to change the url generation code? I tried it for a bit and changed the code in the plugin.py in line 54 in the
build_pages_nav_main(*args)
function from:to:
so that the language code is part of the url. My Code snippet is not optimal, because it always adds the language code, even if it is the default language.