1/4 Nextra v3 with i18n by locale folders#504
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
There was a problem hiding this comment.
why are we bringing these images in?
There was a problem hiding this comment.
There was a problem hiding this comment.
we were pulling these with remote-mdx in past so do we need to commit the files? see the same thing happing for graph-client
There was a problem hiding this comment.
I replaced remote mdx with catch all route [[..slug]].mdx to just fetch them, so in future they will be translated too
| uses: the-guild-org/shared-config/setup@main | ||
| with: | ||
| nodeVersion: 20 | ||
| packageManager: pnpm |
There was a problem hiding this comment.
How does it know which version of Node to use if we don't specify it? (As for pnpm, I guess it either looks at which lockfile exists or at package.json's packageManager.)
There was a problem hiding this comment.
shared-config/setup@v1 looks packageManager field to understand which package manager and version to use.
and about Node.js it looks .node-version or .nvmrc file. @saihaj @enisdenjo correct me if I am wrong
There was a problem hiding this comment.
shared-config/setup@v1 looks packageManager field to understand which package manager and version to use
Yes.
Node.js it looks .node-version or .nvmrc file
Not automatically, you have to provide either the node-version or node-version-file to the action.
| transformPageMap(pageMap) { | ||
| const locale = pageMap[0].data.slice(0, 2) | ||
| return [ | ||
| ...pageMap, | ||
| { | ||
| route: `/${locale}`, | ||
| name: 'index', | ||
| frontMatter: { | ||
| title: translate(translations, locale, 'index.title'), | ||
| }, | ||
| }, | ||
| ] | ||
| }, |
There was a problem hiding this comment.
I'm not quite sure I follow this. It seems to add a route for the [locale]/index.mdx file? Why is it needed for that particular route?
There was a problem hiding this comment.
it's a dynamic route, this is needed to translate sidebarTitle, both works title or sidebarTitle here but I'll rename to sidebarTitle to better understand
website/pages/en/_meta.js
Outdated
| about: '', | ||
| network: 'The Graph Network', | ||
| sunrise: 'Sunrise Upgrade FAQ', | ||
| sunrise: '', |
There was a problem hiding this comment.
I see you moved "Sunrise Upgrade FAQ" out of this file into sunrise.mdx's sidebarTitle frontmatter, but why not do it for every page? Like "The Graph Network" just above?
Also, I guess the only purpose of these _meta.js files now is to set the order of the pages and add headings and separators?
There was a problem hiding this comment.
I see you moved "Sunrise Upgrade FAQ" out of this file into sunrise.mdx's sidebarTitle frontmatter, but why not do it for every page? Like "The Graph Network" just above?
yep, I can do it in another PR
Also, I guess the only purpose of these _meta.js files now is to set the order of the pages and add headings and separators?
exactly
There was a problem hiding this comment.
This file should not be added; instead, any reference to it should be changed to match the existing filename (Delegation-Unbonding.png). I already fixed it in Crowdin, but we can update the sv MDX file manually until the Crowdin PR is merged (I will do it this week promise).
There was a problem hiding this comment.
I know, I just added it temporarily until your PR is merged to the main
There was a problem hiding this comment.
@dimaMachina – I just merged the Crowdin PR (#737) so this file and Indexing-Edward-Cut.png can be deleted. 👍
Co-authored-by: Benoît Rouleau <benoit.rouleau@icloud.com>
website/scripts/fetch-remote-docs.ts
Outdated
|
|
||
| console.log(`✅ Remote files from "${url}" saved!`) | ||
| for (const fp of result.filePaths) { | ||
| const response = await fetch(`https://raw.githubusercontent.com/${user}/${repo}/main/${docsPath}${fp}`) |
There was a problem hiding this comment.
| const response = await fetch(`https://raw.githubusercontent.com/${user}/${repo}/main/${docsPath}${fp}`) | |
| const response = await fetch(`https://raw.githubusercontent.com/${user}/${repo}/${branch}/${docsPath}${fp}`) |
Co-authored-by: Benoît Rouleau <benoit.rouleau@icloud.com>
* aa * more * lint fix * 3/4 Refactor `_meta.js` to prefer `sidebarTitle` (#733) * move mdxStyles * more * more * more * more * more * more * more * more * more * more * more * more * more * more * more * more * more * more * more * more * lint * update nextra * 4/4 move `pages` to `src/pages` (#734) * move pages to src * some refactoring * Update Node * Remove unneeded `try…catch` * `pnpm check:fix` --------- Co-authored-by: benface <benoit.rouleau@icloud.com> --------- Co-authored-by: benface <benoit.rouleau@icloud.com>
|
Superseded by #873 |
This PR includes migration to Nextra 3 with builtin support i18n by folders. More info about changes from v2 can be found in blogpost https://the-guild.dev/blog/nextra-3
also there is support of changing sidebar title via frontmatter prop