diff --git a/packages/docusaurus-plugin-content-blog/src/blogUtils.ts b/packages/docusaurus-plugin-content-blog/src/blogUtils.ts index a87cbd12388d..3e26e44128b0 100644 --- a/packages/docusaurus-plugin-content-blog/src/blogUtils.ts +++ b/packages/docusaurus-plugin-content-blog/src/blogUtils.ts @@ -48,11 +48,7 @@ export function truncate(fileString: string, truncateMarker: RegExp): string { return fileString.split(truncateMarker, 1).shift()!; } -function getPath(value: BlogPost) { - return aliasedSitePathToRelativePath(value.metadata.source); -} - -export function reportTruncateMarkerProblem({ +export function reportUntruncatedBlogPosts({ blogPosts, onUntruncatedBlogPost, }: { @@ -64,7 +60,9 @@ export function reportTruncateMarkerProblem({ ); if (onUntruncatedBlogPost !== 'ignore' && untruncatedBlogPosts.length > 0) { const message = `Docusaurus found untruncated blog posts: -${untruncatedBlogPosts.map(getPath).join('\n- ')} +${untruncatedBlogPosts + .map((p) => aliasedSitePathToRelativePath(p.metadata.source)) + .join('\n- ')} You can turn off this settings by setting onUntruncatedBlogPost to 'ignore' in your docusaurus config file`; logger.report(onUntruncatedBlogPost)(message); } diff --git a/packages/docusaurus-plugin-content-blog/src/index.ts b/packages/docusaurus-plugin-content-blog/src/index.ts index b8b6998f4c4b..b930facb57df 100644 --- a/packages/docusaurus-plugin-content-blog/src/index.ts +++ b/packages/docusaurus-plugin-content-blog/src/index.ts @@ -28,7 +28,7 @@ import { shouldBeListed, applyProcessBlogPosts, generateBlogPosts, - reportTruncateMarkerProblem, + reportUntruncatedBlogPosts, } from './blogUtils'; import footnoteIDFixer from './remark/footnoteIDFixer'; import {translateContent, getTranslationFiles} from './translations'; @@ -186,14 +186,14 @@ export default async function pluginContentBlog( options, authorsMap, ); - reportTruncateMarkerProblem({ - blogPosts, - onUntruncatedBlogPost: options.onUntruncatedBlogPost, - }); blogPosts = await applyProcessBlogPosts({ blogPosts, processBlogPosts: options.processBlogPosts, }); + reportUntruncatedBlogPosts({ + blogPosts, + onUntruncatedBlogPost: options.onUntruncatedBlogPost, + }); const listedBlogPosts = blogPosts.filter(shouldBeListed); if (!blogPosts.length) {