kaiiiz / hugo-theme-monochrome

Monochrome is a fast, clean and responsive hugo theme
https://kaiiiz.github.io/hugo-theme-monochrome/
MIT License
171 stars 52 forks source link

Stay on the same page on language change #14

Open Ran-n opened 2 years ago

Ran-n commented 2 years ago

I've noticed that when you are on a page and change the language it is redirected to the base url. It would be really nice that if im browsing on root/about/ and change the language to galician i wouldnt be redirected to root/gz/ but rather to root/gz/sobre

kaiiiz commented 2 years ago

This feature can be done with minor modifications. However, I'm currently not figured out which implementation is better when a page does not have the supported language:

  1. Only shows the available language for the page.
  2. Show all language that is supported by the site, but for a page that does not have correspondingly language, clicking the link will redirect to the homepage.
  3. Show all language that is supported by the site, but for a page that does not have correspondingly language, the entry in the language list is disabled (i.e., it's shown but not clickable).

I personally prefer solution 3. Any suggestions are welcome.

Nightfirecat commented 2 years ago

Option 3 seems the most usable for any given configuration, but I imagine option 2 would be reasonable also. (perhaps 404 instead of redirect to homepage)

Ran-n commented 2 years ago

Maybe number 3 but when you click it a custom alert message appears indicating that said page doesnt exist in the language clicked. Also, if its not a lot of work, what would be best is to make it open so that the programmer can implement the behaviour they feel its best for each/all cases.