diff --git a/packages/docusaurus-plugin-content-blog/src/blogUtils.ts b/packages/docusaurus-plugin-content-blog/src/blogUtils.ts index cd3c1b8837..3647a34550 100644 --- a/packages/docusaurus-plugin-content-blog/src/blogUtils.ts +++ b/packages/docusaurus-plugin-content-blog/src/blogUtils.ts @@ -323,7 +323,9 @@ async function processBlogSourceFile( } else if (typeof editUrl === 'string') { const isLocalized = blogDirPath === contentPaths.contentPathLocalized; const fileContentPath = - isLocalized && options.editLocalizedFiles + isLocalized && + options.editLocalizedFiles && + contentPaths.contentPathLocalized ? contentPaths.contentPathLocalized : contentPaths.contentPath; diff --git a/packages/docusaurus-utils/src/markdownLinks.ts b/packages/docusaurus-utils/src/markdownLinks.ts index 99dda68e9b..a045ab4cd5 100644 --- a/packages/docusaurus-utils/src/markdownLinks.ts +++ b/packages/docusaurus-utils/src/markdownLinks.ts @@ -20,9 +20,11 @@ export type ContentPaths = { contentPath: string; /** * The absolute path to the localized content directory, like - * `"/i18n/zh-Hans/plugin-content-docs"`. + * `"/i18n/zh-Hans/plugin-content-blog"`. + * + * Undefined when the locale has `translate: false` config */ - contentPathLocalized?: string; + contentPathLocalized: string | undefined; }; /** Data structure representing each broken Markdown link to be reported. */