Skip to content
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

Permalinks of custom collection documents are not translated. #87

Closed
klaasnotfound opened this issue Jan 30, 2017 · 3 comments
Closed

Permalinks of custom collection documents are not translated. #87

klaasnotfound opened this issue Jan 30, 2017 · 3 comments

Comments

@klaasnotfound
Copy link

@klaasnotfound klaasnotfound commented Jan 30, 2017

I am using this plugin for a site with custom collections. In addition to the _posts folder I have an _faq folder that contains a collection of frequently asked questions. For SEO purposes each of these questions should end up with its own translated URL.

In my _config.yml I added

collections:
  faq:
    output: true

and the collection documents are rendered into each language folder. However, the permalinks are always in the default language. I.e. for a site with languages ["de", "en"] (German being the default), all rendered versions of the question

layout: faq
title: faq.how-much

namespace: faq.how-much
permalink: /faq/wieviel-kostet-es
permalink_en: /faq/how-much-does-it-cost

end up having the URL <lang>/faq/wieviel-kostet-es (including the English version).

I looked at the source code of the plugin and realized the permalink translation is missing for documents. Simply copying the permalink translation code to the document code actually fixed the problem, i.e. all links are translated correctly.

Maybe you could double-check whether this is the right way to do it and include this fix in the next release.

@klaasnotfound
Copy link
Author

@klaasnotfound klaasnotfound commented Jan 30, 2017

Oh, one more thing: The link translation tag {% tl ... %} currently doesn't work for collection documents either. I managed to fix this by inserting

collections = site.collections.values.collect{|x| x.docs}.flatten
pages = site.pages + collections

here.

@maesitos
Copy link
Contributor

@maesitos maesitos commented Jun 16, 2019

Pull request created with these changes #137

@shushugah
Copy link
Collaborator

@shushugah shushugah commented Jun 20, 2019

This issue should be closed. Thank you maesitos!

@kurtsson kurtsson closed this Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants