Automatically redirect from '/ folder' to '/folder/index.html' using Hakyll or with another problem with relative links

I want to implement a static HTML website with multiple languages ​​using the Hakyll framework. I did not find a better solution than just setting the default language for the website.com route and any other custom language on the website.com/en route. Since I use static HTML and have several languages, I must have several versions of each page, for example about.html . These pages are generated automatically, so this is not a problem. But currently I have a problem with jumping from these pages ...

I have such a link in my website.com/index.html :

 <a href=about.html> 

When I open this link from website.com/en , I want to go to website.com/en/about.html instead of website.com/about.html . But actually I jump from website.com/en to website.com/about.html . If I switch from website.com/en/index.html , I will go to website.com/en/about.html as I want. Therefore, I am insured by one of two possible solutions:

  • When I go to website.com/en , I want to redirect to website.com/en/index.html . I can see the contents of index.html from website.com/en , but somehow I cannot go to the relative link :(
  • Replace href=about.html with something more smart, so I can automatically go to folder/about.html from any folder.

Any help appreciated!

+5
source share

Source: https://habr.com/ru/post/1273500/


All Articles