Skip to content

Conversation

@a1x42
Copy link
Contributor

@a1x42 a1x42 commented Apr 3, 2020

Prerequisites

Put an x into the box(es) that apply:

  • [x ] This pull request fixes a bug.
  • This pull request adds a feature.
  • This pull request introduces breaking change.

Description

Language links are only displayed for those languages which offer a translation of the current page. When clicked you navigate to the same page in the translated version rather than always returning to the home page.

Issues Resolved

#293

Checklist

Put an x into the box(es) that apply:

General

Resources

  • If you have changed any SCSS code, run make release to regenerate all CSS files

Contributors

  • Add yourself to CONTRIBUTORS.md if you aren't on it already

@sgtrusty
Copy link
Contributor

sgtrusty commented Apr 6, 2020

Not sure how this works exactly. Can you please explain?

@a1x42
Copy link
Contributor Author

a1x42 commented Apr 6, 2020

https://regisphilibert.com/blog/2018/08/hugo-multilingual-part-1-managing-content-translation/ search for “Using linked translations in your template.”

@sgtrusty
Copy link
Contributor

sgtrusty commented Apr 7, 2020

So the rest of the configuration stays the same, the only factor changing is how it's displayed? Thanks for explaining, I am just curious because I want to implement it to my site.

@a1x42
Copy link
Contributor Author

a1x42 commented Apr 7, 2020

yes, assuming all your language versions have the same structure, you will always see all available languages (besides the current one) and on change of language you stay on the same page. works great on my site https://erz.lu

no further config changes required.

@sgtrusty
Copy link
Contributor

sgtrusty commented Apr 8, 2020

Oh, sweet. Your site looks great by the way. I really like the site you posted earlier too, I hope this gets approved; I was thinking of doing the research and adding a similar PR myself. Thanks!

Edit: p.s. -- i added it to my website (which is still wip btw). thanks!

@luizdepra
Copy link
Owner

What happens if there no translation for a specific page? Will it redirect to a 404 page?

@luizdepra
Copy link
Owner

Ok, forget it. The lang selector does not display on pages without translations.

@luizdepra luizdepra merged commit ee91020 into luizdepra:master Apr 8, 2020
@luizdepra
Copy link
Owner

Thank you.

Closes #293.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants