@docusaurus/plugin-content-blog 3.9.2-canary-6437 → 3.9.2-canary-6443
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/blogUtils.js +5 -11
- package/lib/routes.js +14 -6
- package/package.json +10 -10
- package/src/blogUtils.ts +5 -10
- package/src/routes.ts +13 -7
package/lib/blogUtils.js
CHANGED
|
@@ -132,7 +132,7 @@ async function parseBlogPostMarkdownFile({ filePath, parseFrontMatter, }) {
|
|
|
132
132
|
}
|
|
133
133
|
const defaultReadingTime = ({ content, locale, options }) => (0, readingTime_1.calculateReadingTime)(content, locale, options);
|
|
134
134
|
async function processBlogSourceFile(blogSourceRelative, contentPaths, context, options, tagsFile, authorsMap) {
|
|
135
|
-
const { siteConfig: { baseUrl, markdown: { parseFrontMatter }, }, siteDir, i18n, } = context;
|
|
135
|
+
const { siteConfig: { baseUrl, markdown: { parseFrontMatter }, future: { experimental_vcs: vcs }, }, siteDir, i18n, } = context;
|
|
136
136
|
const { routeBasePath, tagsBasePath: tagsRouteBasePath, truncateMarker, showReadingTime, editUrl, } = options;
|
|
137
137
|
// Lookup in localized folder in priority
|
|
138
138
|
const blogDirPath = await (0, utils_1.getFolderContainingFile)((0, utils_1.getContentPathList)(contentPaths), blogSourceRelative);
|
|
@@ -142,7 +142,7 @@ async function processBlogSourceFile(blogSourceRelative, contentPaths, context,
|
|
|
142
142
|
parseFrontMatter,
|
|
143
143
|
});
|
|
144
144
|
const aliasedSource = (0, utils_1.aliasedSitePath)(blogSourceAbsolute, siteDir);
|
|
145
|
-
const lastUpdate = await (0, utils_1.readLastUpdateData)(blogSourceAbsolute, options, frontMatter.last_update);
|
|
145
|
+
const lastUpdate = await (0, utils_1.readLastUpdateData)(blogSourceAbsolute, options, frontMatter.last_update, vcs);
|
|
146
146
|
const draft = (0, utils_1.isDraft)({ frontMatter });
|
|
147
147
|
const unlisted = (0, utils_1.isUnlisted)({ frontMatter });
|
|
148
148
|
if (draft) {
|
|
@@ -165,17 +165,11 @@ async function processBlogSourceFile(blogSourceRelative, contentPaths, context,
|
|
|
165
165
|
else if (parsedBlogFileName.date) {
|
|
166
166
|
return parsedBlogFileName.date;
|
|
167
167
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
age: 'oldest',
|
|
171
|
-
includeAuthor: false,
|
|
172
|
-
});
|
|
173
|
-
return result.date;
|
|
174
|
-
}
|
|
175
|
-
catch (err) {
|
|
176
|
-
logger_1.default.warn(err);
|
|
168
|
+
const result = await vcs.getFileCreationInfo(blogSourceAbsolute);
|
|
169
|
+
if (result == null) {
|
|
177
170
|
return (await fs_extra_1.default.stat(blogSourceAbsolute)).birthtime;
|
|
178
171
|
}
|
|
172
|
+
return new Date(result.timestamp);
|
|
179
173
|
}
|
|
180
174
|
const date = await getDate();
|
|
181
175
|
const title = frontMatter.title ?? contentTitle ?? parsedBlogFileName.text;
|
package/lib/routes.js
CHANGED
|
@@ -197,10 +197,14 @@ async function buildAllRoutes({ baseUrl, content, actions, options, aliasedSourc
|
|
|
197
197
|
sidebar: sidebarModulePath,
|
|
198
198
|
},
|
|
199
199
|
props: {
|
|
200
|
-
authors: authors.map((author) =>
|
|
201
|
-
author
|
|
202
|
-
|
|
203
|
-
|
|
200
|
+
authors: authors.map((author) => {
|
|
201
|
+
const authorPosts = blogPostsByAuthorKey[author.key] ?? [];
|
|
202
|
+
const listedAuthorPosts = authorPosts.filter(blogUtils_1.shouldBeListed);
|
|
203
|
+
return (0, props_1.toAuthorItemProp)({
|
|
204
|
+
author,
|
|
205
|
+
count: listedAuthorPosts.length,
|
|
206
|
+
});
|
|
207
|
+
}),
|
|
204
208
|
},
|
|
205
209
|
context: {
|
|
206
210
|
blogMetadata: blogMetadataModulePath,
|
|
@@ -209,11 +213,12 @@ async function buildAllRoutes({ baseUrl, content, actions, options, aliasedSourc
|
|
|
209
213
|
}
|
|
210
214
|
function createAuthorPaginatedRoute(author) {
|
|
211
215
|
const authorBlogPosts = blogPostsByAuthorKey[author.key] ?? [];
|
|
216
|
+
const listedAuthorBlogPosts = authorBlogPosts.filter(blogUtils_1.shouldBeListed);
|
|
212
217
|
if (!author.page) {
|
|
213
218
|
return [];
|
|
214
219
|
}
|
|
215
220
|
const pages = (0, blogUtils_1.paginateBlogPosts)({
|
|
216
|
-
blogPosts:
|
|
221
|
+
blogPosts: listedAuthorBlogPosts,
|
|
217
222
|
basePageUrl: author.page.permalink,
|
|
218
223
|
blogDescription,
|
|
219
224
|
blogTitle,
|
|
@@ -230,7 +235,10 @@ async function buildAllRoutes({ baseUrl, content, actions, options, aliasedSourc
|
|
|
230
235
|
sidebar: sidebarModulePath,
|
|
231
236
|
},
|
|
232
237
|
props: {
|
|
233
|
-
author: (0, props_1.toAuthorItemProp)({
|
|
238
|
+
author: (0, props_1.toAuthorItemProp)({
|
|
239
|
+
author,
|
|
240
|
+
count: listedAuthorBlogPosts.length,
|
|
241
|
+
}),
|
|
234
242
|
listMetadata: metadata,
|
|
235
243
|
},
|
|
236
244
|
context: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-blog",
|
|
3
|
-
"version": "3.9.2-canary-
|
|
3
|
+
"version": "3.9.2-canary-6443",
|
|
4
4
|
"description": "Blog plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/plugin-content-blog.d.ts",
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
},
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@docusaurus/core": "3.9.2-canary-
|
|
35
|
-
"@docusaurus/logger": "3.9.2-canary-
|
|
36
|
-
"@docusaurus/mdx-loader": "3.9.2-canary-
|
|
37
|
-
"@docusaurus/theme-common": "3.9.2-canary-
|
|
38
|
-
"@docusaurus/types": "3.9.2-canary-
|
|
39
|
-
"@docusaurus/utils": "3.9.2-canary-
|
|
40
|
-
"@docusaurus/utils-common": "3.9.2-canary-
|
|
41
|
-
"@docusaurus/utils-validation": "3.9.2-canary-
|
|
34
|
+
"@docusaurus/core": "3.9.2-canary-6443",
|
|
35
|
+
"@docusaurus/logger": "3.9.2-canary-6443",
|
|
36
|
+
"@docusaurus/mdx-loader": "3.9.2-canary-6443",
|
|
37
|
+
"@docusaurus/theme-common": "3.9.2-canary-6443",
|
|
38
|
+
"@docusaurus/types": "3.9.2-canary-6443",
|
|
39
|
+
"@docusaurus/utils": "3.9.2-canary-6443",
|
|
40
|
+
"@docusaurus/utils-common": "3.9.2-canary-6443",
|
|
41
|
+
"@docusaurus/utils-validation": "3.9.2-canary-6443",
|
|
42
42
|
"cheerio": "1.0.0-rc.12",
|
|
43
43
|
"feed": "^4.2.2",
|
|
44
44
|
"fs-extra": "^11.1.1",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"@total-typescript/shoehorn": "^0.1.2",
|
|
63
63
|
"tree-node-cli": "^1.6.0"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "a25dde30cfb44b2e621d62c4a58e371e3d9c96bf"
|
|
66
66
|
}
|
package/src/blogUtils.ts
CHANGED
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
Globby,
|
|
20
20
|
groupTaggedItems,
|
|
21
21
|
getTagVisibility,
|
|
22
|
-
getFileCommitDate,
|
|
23
22
|
getContentPathList,
|
|
24
23
|
isUnlisted,
|
|
25
24
|
isDraft,
|
|
@@ -225,6 +224,7 @@ async function processBlogSourceFile(
|
|
|
225
224
|
siteConfig: {
|
|
226
225
|
baseUrl,
|
|
227
226
|
markdown: {parseFrontMatter},
|
|
227
|
+
future: {experimental_vcs: vcs},
|
|
228
228
|
},
|
|
229
229
|
siteDir,
|
|
230
230
|
i18n,
|
|
@@ -257,6 +257,7 @@ async function processBlogSourceFile(
|
|
|
257
257
|
blogSourceAbsolute,
|
|
258
258
|
options,
|
|
259
259
|
frontMatter.last_update,
|
|
260
|
+
vcs,
|
|
260
261
|
);
|
|
261
262
|
|
|
262
263
|
const draft = isDraft({frontMatter});
|
|
@@ -285,17 +286,11 @@ async function processBlogSourceFile(
|
|
|
285
286
|
return parsedBlogFileName.date;
|
|
286
287
|
}
|
|
287
288
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
age: 'oldest',
|
|
291
|
-
includeAuthor: false,
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
return result.date;
|
|
295
|
-
} catch (err) {
|
|
296
|
-
logger.warn(err);
|
|
289
|
+
const result = await vcs.getFileCreationInfo(blogSourceAbsolute);
|
|
290
|
+
if (result == null) {
|
|
297
291
|
return (await fs.stat(blogSourceAbsolute)).birthtime;
|
|
298
292
|
}
|
|
293
|
+
return new Date(result.timestamp);
|
|
299
294
|
}
|
|
300
295
|
|
|
301
296
|
const date = await getDate();
|
package/src/routes.ts
CHANGED
|
@@ -294,12 +294,14 @@ export async function buildAllRoutes({
|
|
|
294
294
|
sidebar: sidebarModulePath,
|
|
295
295
|
},
|
|
296
296
|
props: {
|
|
297
|
-
authors: authors.map((author) =>
|
|
298
|
-
|
|
297
|
+
authors: authors.map((author) => {
|
|
298
|
+
const authorPosts = blogPostsByAuthorKey[author.key] ?? [];
|
|
299
|
+
const listedAuthorPosts = authorPosts.filter(shouldBeListed);
|
|
300
|
+
return toAuthorItemProp({
|
|
299
301
|
author,
|
|
300
|
-
count:
|
|
301
|
-
})
|
|
302
|
-
),
|
|
302
|
+
count: listedAuthorPosts.length,
|
|
303
|
+
});
|
|
304
|
+
}),
|
|
303
305
|
},
|
|
304
306
|
context: {
|
|
305
307
|
blogMetadata: blogMetadataModulePath,
|
|
@@ -309,12 +311,13 @@ export async function buildAllRoutes({
|
|
|
309
311
|
|
|
310
312
|
function createAuthorPaginatedRoute(author: AuthorWithKey): RouteConfig[] {
|
|
311
313
|
const authorBlogPosts = blogPostsByAuthorKey[author.key] ?? [];
|
|
314
|
+
const listedAuthorBlogPosts = authorBlogPosts.filter(shouldBeListed);
|
|
312
315
|
if (!author.page) {
|
|
313
316
|
return [];
|
|
314
317
|
}
|
|
315
318
|
|
|
316
319
|
const pages = paginateBlogPosts({
|
|
317
|
-
blogPosts:
|
|
320
|
+
blogPosts: listedAuthorBlogPosts,
|
|
318
321
|
basePageUrl: author.page.permalink,
|
|
319
322
|
blogDescription,
|
|
320
323
|
blogTitle,
|
|
@@ -332,7 +335,10 @@ export async function buildAllRoutes({
|
|
|
332
335
|
sidebar: sidebarModulePath,
|
|
333
336
|
},
|
|
334
337
|
props: {
|
|
335
|
-
author: toAuthorItemProp({
|
|
338
|
+
author: toAuthorItemProp({
|
|
339
|
+
author,
|
|
340
|
+
count: listedAuthorBlogPosts.length,
|
|
341
|
+
}),
|
|
336
342
|
listMetadata: metadata,
|
|
337
343
|
},
|
|
338
344
|
context: {
|