We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
_meta.en.json
I am trying to add Nextra docs on subroute with i18n support, but the _meta.en.json or _meta.es.json is not getting picked up by nextra.
_meta.es.json
My next config is
const withNextra = require("nextra")({ theme: "nextra-theme-docs", themeConfig: "./src/theme.config.jsx", i18n: { locales: ["en", "es"], defaultLocale: "en", localeDetection: false, }, }); module.exports = withNextra(nextConfig);
My middleware code is
// middleware.ts export const middleware = async (request) => { // ...REDACTED const pathnameIsMissingLocale: boolean = SUPPORTED_LOCALES.every( (locale) => !pathname.startsWith(`/${locale}/`) && pathname !== `/${locale}` ); if (pathnameIsMissingLocale) { const locale = getLocale(request); return NextResponse.redirect( new URL(search ? `/${locale}/${pathname}${search}` : `/${locale}/${pathname}`, request.url) ); } }
The middleware adds the locale and redirects the path if locale does not exist in path.
The _meta.en.json under Pages directory is like this
{ "index": { "title": "Documentation", "type": "page", "href": "/docs" }, "frameworks": { "title": "Frameworks", "type": "page", "href": "/docs/frameworks" }, "faqs": { "title": "FAQs", "type": "page", "href": "/docs/faqs" } }
And the
{ "index": { "title": "Documentation Spanish", "type": "page", "href": "/docs" }, "frameworks": { "title": "Frameworks Spanish", "type": "page", "href": "/docs/frameworks" }, "faqs": { "title": "FAQs Spanish", "type": "page", "href": "/docs/faqs" } }
But I am getting 404 page for /en/docs and /es/docs
/en/docs
/es/docs
The pages directory tree is this
src/pages/ ├── [lang] │ └── docs │ ├── faqs.en.mdx │ ├── faqs.es.mdx │ ├── frameworks.en.mdx │ ├── frameworks.es.mdx │ ├── frameworks.mdx │ ├── index.en.mdx │ └── index.es.mdx ├── _meta.en.json └── _meta.es.json
Am I doing anything wrong here ?
The text was updated successfully, but these errors were encountered:
Is this related to this PR ?
ignore loading pageMap for dynamic locale /[locale]
/[locale]
Sorry, something went wrong.
Use v2 example https://github.com/shuding/nextra/tree/main/examples/swr-site
Or v3 example https://github.com/shuding/nextra/tree/v3/examples/swr-site
Migration guide https://the-guild.dev/blog/nextra-3
I am using Nextra versions
"nextra": "^2.13.4", "nextra-theme-docs": "^2.13.4",
After following the v2 Example, I am still getting 404 pages.
This is the directory structure I used, changed to locale to use en-US than en, but en also didnt work.
en-US
en
src/pages ├── docs │ ├── faqs.en-US.mdx │ ├── frameworks.en-US.mdx │ └── index.en-US.mdx └── _meta.en-US.json
No branches or pull requests
I am trying to add Nextra docs on subroute with i18n support, but the
_meta.en.json
or_meta.es.json
is not getting picked up by nextra.My next config is
My middleware code is
The middleware adds the locale and redirects the path if locale does not exist in path.
The
_meta.en.json
under Pages directory is like thisAnd the
But I am getting 404 page for
/en/docs
and/es/docs
The pages directory tree is this
Am I doing anything wrong here ?
The text was updated successfully, but these errors were encountered: