shuding / nextra

Simple, powerful and flexible site generation framework with everything you love from Next.js.
https://nextra.site
MIT License
11.7k stars 1.27k forks source link

i18n index files do not work for subfolders #1263

Closed alex-flea closed 1 year ago

alex-flea commented 1 year ago

Somewhere between 2.0.0 and 2.2.3 index files for subfolders such as index.en.mdx or index.ro.mdx stopped working when referencing them by pretty urls, i.e localhost:3000/subfolder produces 404 error, but localhost:3000/subfolder/index returns the corresponding page.

At the same time indexes for root folder work fine, i.e. localhost:3000 or localhost:3000/ro.

alex-flea commented 1 year ago

It seems that the problem is due to changed behavior in handling i18n.

Following the steps described in https://nextra.site/docs/guide/i18n everything works fine but index files in subfolders. At the same time, without adding middleware, just following steps described in https://nextjs.org/docs/advanced-features/i18n-routing nextra does not recognize localized files with lang postfixes for the default locale (i.e. index.en.mdx) but indexes seem to work fine. Nevertheless, i18n routing seems broken either.

Which is the correct way of setting up i18n project with nextra v2?

mattvb91 commented 1 year ago

@alex-flea did you get this working? Same issue

alex-flea commented 1 year ago

@alex-flea did you get this working? Same issue

Nope. Each new update I check if it fixed but as for 2.2.9 it's still broken. As workaround I'm using index1.en.mdx hack.

mattvb91 commented 1 year ago

yea unfortunately everything I look at i18n is completely broken it seems

alex-flea commented 1 year ago

v1 worked fine with i18n. At the same time, v2 is worth hussle. As for i18n, the only problem I found is index files problem, everything else works fine.

As workaround just rename index into anything else and update your _meta accordingly.

ysm-dev commented 1 year ago

+1

tiagobarros01 commented 1 year ago

+1

Prottoy2938 commented 1 year ago

Any solve yet?

Prottoy2938 commented 1 year ago

@alex-flea did you get this working? Same issue

Nope. Each new update I check if it fixed but as for 2.2.9 it's still broken. As workaround I'm using index1.en.mdx hack.

whats the index1.en.mdx hack? It didn' worked for me. I still have to go to "/subfolder/index1" to reach the desired page instead of "/subfolders". Can you explain?

alex-flea commented 1 year ago

whats the index1.en.mdx hack? It didn' worked for me. I still have to go to "/subfolder/index1" to reach the desired page instead of "/subfolders". Can you explain?

Yes, exactly. I ment using index1 in URLs and links meanwhile. No magic pill unfortunatelly.

erichosick commented 1 year ago

As of July 16th, 2023, this is still an issue.

dimaMachina commented 1 year ago

closed by https://github.com/shuding/nextra/pull/2250

https://github.com/shuding/nextra/releases/tag/nextra%403.0.0-alpha.0