-
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
Is there a way to link posts in different languages with no similar filename or permalink? #98
Comments
I guess you would have to make a patch for that around polyglot/lib/jekyll/polyglot/patches/jekyll/site.rb Lines 93 to 105 in d1a5c85
|
I've somehow managed to make it work with the lib defaults! All my spanish posts are stored in the root _posts folder and all the english ones are stored inside the _posts/en/ folder. I didn't even set a So, all in all, what I did was:
You can see it working here: https://streetrunners.gitlab.io/ Please check how when accessing a post in the default language and then switching to English from the menu, everything works. Also, the homepage paginates only the posts in the language the user is in. My only problem is that I cannot access /en/index.html directly, as it looks like it's not processed by Jekyll. So accessing the homepage and then trying to change the language from there doesn't work. |
Hi, module Jekyll
class Page
#======================================
# permalink
#======================================
def permalink
return nil if data.nil?
# Give precedence to permalink_i18n
if data['permalink_i18n'] && data['permalink_i18n'][@site.active_lang]
return data['permalink_i18n'][@site.active_lang]
end
# Fall back to permalink
return data['permalink']
end
end
end And it works if you put this in front matter: permalink_i18n:
es: "/permalink_en_español/"
en: "/permalink_in_english/" I've learn ruby this week so I don't have the expertise to make a pull request, but maybe you guys could view it and add as a new Feature? Regards, |
Hi @seblaz I love this, however - probably need to adjust it so it automatically adjust the links to the correct lang (as defined here) as this doesn't correctly update the link. Also would need someway to pointing links to a page reference otherwise it'll be complicated to manage all your links in this way. |
Is this a duplicate of #33 ? |
This is what page_id is for, isn't it? |
I would like to link two posts written in different languages like this:
2018-10-09-post-a.md
2019-01-01-totally-different-filename.md
I don't want to hardcode permalinks in the front matter of each post, I'd rather let Jekyll create them from what I specify in
_config.yml
. I don't want to name the files the same as I'd like each to have it's own translated title. Is there a way to link them just with thisref
variable?Thanks
The text was updated successfully, but these errors were encountered: