-
Notifications
You must be signed in to change notification settings - Fork 60
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
Ability to get a page URL in another language when page_id is used #199
Comments
Have you seen these examples?
these use the yeah those examples are pages, not posts. But that shouldn't matter necessarily. |
Thanks for the examples. However, these examples all make usage of the |
Maybe you can create a generator plugin for your specific case? Then you can try to make it run before polyglot by setting its priority. |
It ensures that the permalink_lang attribute is set correctly and can be used when a permalink attribute is set at the site level. It is, indeed, not enough to check if the permalink is undefined. The permalink might be set to empty. Moreover, we should check that the page has a lang attribute isn't empty as well.
It ensures that the permalink_lang attribute is set correctly and can be used when a permalink attribute is set at the site level. It is, indeed, not enough to check if the permalink is undefined. The permalink might be set to empty. Moreover, we should check that the page has a lang attribute isn't empty as well.
Context
I want to be able to have different URLs for posts in different languages. e.g:
Today, this is possible to do it thanks to the
page_id
in the front matter of the post.However, for this to work, you'll need to specify a permalink for each post, which is quite annoying.
Why? Because, if you can easily forget to enter this attribute and then switching from one language to another won't work.
In Jekyll, you can add a default permalink attribute for all the pages. However, this doesn't seem to be taken into account by polyglot. Thus accessing the permalink through
permalink_lang[lang]
doesn't work.Experiments
What I tried so far, was to create a language selector that would retrieve all the site.posts and site.pages.
Why? Because, I wanted to access the
url
attribute of a post/page in another language.However, these are already filtered out by polyglot before I access them.
Thus it's impossible to get this
url
attribute.This is confirmed by these issues: 186, 53, 88.
Ideas
Reading issue 186, it seems there is no will to implement it.
However, is there any other way to get these URLs?
Would it be possible to implement an attribute
url_lang
similar to thepermalink_lang
?Thanks for any advice.
The text was updated successfully, but these errors were encountered: