MCPcopy
hub / github.com/facebook/docusaurus / loadContent

Function loadContent

packages/docusaurus-plugin-content-blog/src/index.ts:218–326  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

216
217 // Fetches blog contents and returns metadata for the necessary routes.
218 async loadContent() {
219 const {
220 postsPerPage: postsPerPageOption,
221 routeBasePath,
222 tagsBasePath,
223 blogDescription,
224 blogTitle,
225 blogSidebarTitle,
226 pageBasePath,
227 authorsBasePath,
228 authorsMapPath,
229 } = options;
230
231 const baseBlogUrl = normalizeUrl([baseUrl, routeBasePath]);
232 const blogTagsListPath = normalizeUrl([baseBlogUrl, tagsBasePath]);
233
234 async function getAuthorsMapChecked() {
235 const result = await getAuthorsMap({
236 contentPaths,
237 authorsMapPath,
238 authorsBaseRoutePath: normalizeUrl([
239 baseUrl,
240 routeBasePath,
241 authorsBasePath,
242 ]),
243 baseUrl,
244 });
245 checkAuthorsMapPermalinkCollisions(result);
246 return result;
247 }
248
249 // Read all the input files in parallel
250 const {authorsMap, tagsFile} = await combinePromises({
251 authorsMap: getAuthorsMapChecked(),
252 tagsFile: getTagsFile({contentPaths, tags: options.tags}),
253 });
254
255 let blogPosts = await generateBlogPosts(
256 contentPaths,
257 context,
258 options,
259 tagsFile,
260 authorsMap,
261 );
262 blogPosts = await applyProcessBlogPosts({
263 blogPosts,
264 processBlogPosts: options.processBlogPosts,
265 });
266 reportUntruncatedBlogPosts({
267 blogPosts,
268 onUntruncatedBlogPosts: options.onUntruncatedBlogPosts,
269 });
270 const listedBlogPosts = blogPosts.filter(shouldBeListed);
271
272 if (!blogPosts.length) {
273 return {
274 blogTitle,
275 blogDescription,

Callers

nothing calls this directly

Calls 7

normalizeUrlFunction · 0.90
getTagsFileFunction · 0.90
generateBlogPostsFunction · 0.90
applyProcessBlogPostsFunction · 0.90
getBlogTagsFunction · 0.90
getAuthorsMapCheckedFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…