Skip to content

Commit

Permalink
rename to reportUntruncatedBlogPosts + move after processBlogPosts
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Aug 9, 2024
1 parent 6513c3a commit 56b71c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
10 changes: 4 additions & 6 deletions packages/docusaurus-plugin-content-blog/src/blogUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}: {
Expand All @@ -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);
}
Expand Down
10 changes: 5 additions & 5 deletions packages/docusaurus-plugin-content-blog/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
shouldBeListed,
applyProcessBlogPosts,
generateBlogPosts,
reportTruncateMarkerProblem,
reportUntruncatedBlogPosts,
} from './blogUtils';
import footnoteIDFixer from './remark/footnoteIDFixer';
import {translateContent, getTranslationFiles} from './translations';
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 56b71c0

Please sign in to comment.