Skip to content

fix: follow Docusaurus version routing and i18n content in versions mode - #88

Merged
rachfop merged 2 commits into
mainfrom
fix/versions-i18n
Oct 2, 2026
Merged

rachfop merged 2 commits into
mainfrom
fix/versions-i18n

Conversation

@rachfop

@rachfop rachfop commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Versioned and translated sites got wrong links and the wrong content:

  • versions: 'auto' assumed each version owned a leading URL prefix. On a default Docusaurus site the current docs linked to the latest release's pages and versioned files linked to /versioned_docs/... 404s. Auto mode now builds versions from the docs plugin config the way Docusaurus does (lastVersion, /docs/next/, version path, includeCurrentVersion, onlyIncludeVersions, disableVersioning) and scopes each version to /<routeBasePath>/<versionPath>/. Explicit versions arrays behave as before, and a new routePrefix field lets them describe the same layout.
  • Each locale's files had the source-language text. Pages now read their translation from the locale's i18n/ directory, falling back to the source file, unless the locale sets translate: false.
  • Per-version docsDir, customLLMFiles, and includeOrder only got shape checks, so a bad value failed at build time and stopped every later version while the build reported success. They now get the top-level validation, and one version's runtime failure no longer stops the others.
  • In versions mode, blog posts were listed in every version; they appear in the root version only.

tests/test-versions-i18n.js covers each case. Real Docusaurus 3.10.2 builds of a versioned site with an fr locale, across four version configurations, have every llms.txt link resolve to a built page with matching content. The docs site's llms.txt is unchanged; its generated .md copies differ only by the docs edits in this PR.

- versions: 'auto' builds versions the way plugin-content-docs does
  (lastVersion, includeCurrentVersion, onlyIncludeVersions, per-version
  path; routes at /<routeBasePath>/<versionPath>/), writes each version to
  <outDir>/<versionPath>/ and scopes each doc to its version's routes.
  Explicit versions accept routePrefix: '' for the same layout.
- A non-default locale reads each doc and blog post from its translation
  under the localization directory when one exists.
- Per-version docsDir, customLLMFiles and includeOrder get the top-level
  validation; a version that fails at runtime is logged and the remaining
  versions still generate.
- In versions mode the blog is listed in the root version only.
Docusaurus reads a locale's localization directory first for every
locale, the default included (getVersionMetadataPaths and
getContentPathList in @docusaurus/plugin-content-docs and
@docusaurus/utils), unless the locale sets translate: false. Apply the
same rule, so i18n/<defaultLocale>/ overrides reach llms.txt.
@rachfop
rachfop merged commit 445b22f into main Oct 2, 2026
5 checks passed
@rachfop
rachfop deleted the fix/versions-i18n branch October 2, 2026 23:26
rachfop added a commit that referenced this pull request Oct 2, 2026
…ode (#88)

* fix: follow Docusaurus version routing and i18n content in versions mode

- versions: 'auto' builds versions the way plugin-content-docs does
  (lastVersion, includeCurrentVersion, onlyIncludeVersions, per-version
  path; routes at /<routeBasePath>/<versionPath>/), writes each version to
  <outDir>/<versionPath>/ and scopes each doc to its version's routes.
  Explicit versions accept routePrefix: '' for the same layout.
- A non-default locale reads each doc and blog post from its translation
  under the localization directory when one exists.
- Per-version docsDir, customLLMFiles and includeOrder get the top-level
  validation; a version that fails at runtime is logged and the remaining
  versions still generate.
- In versions mode the blog is listed in the root version only.

* fix: read translated files for the default locale too

Docusaurus reads a locale's localization directory first for every
locale, the default included (getVersionMetadataPaths and
getContentPathList in @docusaurus/plugin-content-docs and
@docusaurus/utils), unless the locale sets translate: false. Apply the
same rule, so i18n/<defaultLocale>/ overrides reach llms.txt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant