@docusaurus/plugin-content-blog 0.0.0-4523 → 0.0.0-4524
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/authors.js +5 -4
- package/lib/blogUtils.js +3 -5
- package/lib/index.js +4 -2
- package/package.json +9 -9
- package/src/authors.ts +5 -4
- package/src/blogUtils.ts +3 -4
- package/src/index.ts +4 -2
package/lib/authors.js
CHANGED
|
@@ -52,9 +52,9 @@ function getFrontMatterAuthorLegacy(frontMatter) {
|
|
|
52
52
|
function normalizeFrontMatterAuthors(frontMatterAuthors = []) {
|
|
53
53
|
function normalizeAuthor(authorInput) {
|
|
54
54
|
if (typeof authorInput === 'string') {
|
|
55
|
-
// Technically, we could allow users to provide an author's name here
|
|
56
|
-
//
|
|
57
|
-
//
|
|
55
|
+
// Technically, we could allow users to provide an author's name here, but
|
|
56
|
+
// we only support keys, otherwise, a typo in a key would fallback to
|
|
57
|
+
// becoming a name and may end up unnoticed
|
|
58
58
|
return { key: authorInput };
|
|
59
59
|
}
|
|
60
60
|
return authorInput;
|
|
@@ -97,7 +97,8 @@ function getBlogPostAuthors(params) {
|
|
|
97
97
|
const authorLegacy = getFrontMatterAuthorLegacy(params.frontMatter);
|
|
98
98
|
const authors = getFrontMatterAuthors(params);
|
|
99
99
|
if (authorLegacy) {
|
|
100
|
-
// Technically, we could allow mixing legacy/authors front matter, but do we
|
|
100
|
+
// Technically, we could allow mixing legacy/authors front matter, but do we
|
|
101
|
+
// really want to?
|
|
101
102
|
if (authors.length > 0) {
|
|
102
103
|
throw new Error(`To declare blog post authors, use the 'authors' front matter in priority.
|
|
103
104
|
Don't mix 'authors' with other existing 'author_*' front matter. Choose one or the other, not both at the same time.`);
|
package/lib/blogUtils.js
CHANGED
|
@@ -44,11 +44,9 @@ function parseBlogFileName(blogSourceRelative) {
|
|
|
44
44
|
const slug = `/${slugDate}/${folder}${text}`;
|
|
45
45
|
return { date, text, slug };
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return { date: undefined, text, slug };
|
|
51
|
-
}
|
|
47
|
+
const text = blogSourceRelative.replace(/(\/index)?\.mdx?$/, '');
|
|
48
|
+
const slug = `/${text}`;
|
|
49
|
+
return { date: undefined, text, slug };
|
|
52
50
|
}
|
|
53
51
|
exports.parseBlogFileName = parseBlogFileName;
|
|
54
52
|
function formatBlogPostDate(locale, date) {
|
package/lib/index.js
CHANGED
|
@@ -193,7 +193,8 @@ async function pluginContentBlog(context, options) {
|
|
|
193
193
|
modules: {
|
|
194
194
|
sidebar: aliasedSource(sidebarProp),
|
|
195
195
|
items: items.map((postID) =>
|
|
196
|
-
// To tell routes.js this is an import and not a nested object
|
|
196
|
+
// To tell routes.js this is an import and not a nested object
|
|
197
|
+
// to recurse.
|
|
197
198
|
({
|
|
198
199
|
content: {
|
|
199
200
|
__import: true,
|
|
@@ -311,7 +312,8 @@ async function pluginContentBlog(context, options) {
|
|
|
311
312
|
// For blog posts a title in markdown is always removed
|
|
312
313
|
// Blog posts title are rendered separately
|
|
313
314
|
removeContentTitle: true,
|
|
314
|
-
// Assets allow to convert some relative images paths to
|
|
315
|
+
// Assets allow to convert some relative images paths to
|
|
316
|
+
// require() calls
|
|
315
317
|
createAssets: ({ frontMatter, metadata, }) => ({
|
|
316
318
|
image: frontMatter.image,
|
|
317
319
|
authorsImageUrls: metadata.authors.map((author) => author.imageURL),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-blog",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4524",
|
|
4
4
|
"description": "Blog plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/plugin-content-blog.d.ts",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@docusaurus/core": "0.0.0-
|
|
22
|
-
"@docusaurus/logger": "0.0.0-
|
|
23
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
24
|
-
"@docusaurus/utils": "0.0.0-
|
|
25
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
26
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
21
|
+
"@docusaurus/core": "0.0.0-4524",
|
|
22
|
+
"@docusaurus/logger": "0.0.0-4524",
|
|
23
|
+
"@docusaurus/mdx-loader": "0.0.0-4524",
|
|
24
|
+
"@docusaurus/utils": "0.0.0-4524",
|
|
25
|
+
"@docusaurus/utils-common": "0.0.0-4524",
|
|
26
|
+
"@docusaurus/utils-validation": "0.0.0-4524",
|
|
27
27
|
"cheerio": "^1.0.0-rc.10",
|
|
28
28
|
"feed": "^4.2.2",
|
|
29
29
|
"fs-extra": "^10.0.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"webpack": "^5.61.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@docusaurus/types": "0.0.0-
|
|
38
|
+
"@docusaurus/types": "0.0.0-4524",
|
|
39
39
|
"escape-string-regexp": "^4.0.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=14"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "41a6bff3a67446f7d2a2972cbe4d05fec7378a15"
|
|
50
50
|
}
|
package/src/authors.ts
CHANGED
|
@@ -83,9 +83,9 @@ function normalizeFrontMatterAuthors(
|
|
|
83
83
|
authorInput: string | BlogPostFrontMatterAuthor,
|
|
84
84
|
): BlogPostFrontMatterAuthor {
|
|
85
85
|
if (typeof authorInput === 'string') {
|
|
86
|
-
// Technically, we could allow users to provide an author's name here
|
|
87
|
-
//
|
|
88
|
-
//
|
|
86
|
+
// Technically, we could allow users to provide an author's name here, but
|
|
87
|
+
// we only support keys, otherwise, a typo in a key would fallback to
|
|
88
|
+
// becoming a name and may end up unnoticed
|
|
89
89
|
return {key: authorInput};
|
|
90
90
|
}
|
|
91
91
|
return authorInput;
|
|
@@ -137,7 +137,8 @@ export function getBlogPostAuthors(params: AuthorsParam): Author[] {
|
|
|
137
137
|
const authors = getFrontMatterAuthors(params);
|
|
138
138
|
|
|
139
139
|
if (authorLegacy) {
|
|
140
|
-
// Technically, we could allow mixing legacy/authors front matter, but do we
|
|
140
|
+
// Technically, we could allow mixing legacy/authors front matter, but do we
|
|
141
|
+
// really want to?
|
|
141
142
|
if (authors.length > 0) {
|
|
142
143
|
throw new Error(
|
|
143
144
|
`To declare blog post authors, use the 'authors' front matter in priority.
|
package/src/blogUtils.ts
CHANGED
|
@@ -82,11 +82,10 @@ export function parseBlogFileName(
|
|
|
82
82
|
const slugDate = dateString.replace(/-/g, '/');
|
|
83
83
|
const slug = `/${slugDate}/${folder}${text}`;
|
|
84
84
|
return {date, text, slug};
|
|
85
|
-
} else {
|
|
86
|
-
const text = blogSourceRelative.replace(/(\/index)?\.mdx?$/, '');
|
|
87
|
-
const slug = `/${text}`;
|
|
88
|
-
return {date: undefined, text, slug};
|
|
89
85
|
}
|
|
86
|
+
const text = blogSourceRelative.replace(/(\/index)?\.mdx?$/, '');
|
|
87
|
+
const slug = `/${text}`;
|
|
88
|
+
return {date: undefined, text, slug};
|
|
90
89
|
}
|
|
91
90
|
|
|
92
91
|
function formatBlogPostDate(locale: string, date: Date): string {
|
package/src/index.ts
CHANGED
|
@@ -322,7 +322,8 @@ export default async function pluginContentBlog(
|
|
|
322
322
|
modules: {
|
|
323
323
|
sidebar: aliasedSource(sidebarProp),
|
|
324
324
|
items: items.map((postID) =>
|
|
325
|
-
// To tell routes.js this is an import and not a nested object
|
|
325
|
+
// To tell routes.js this is an import and not a nested object
|
|
326
|
+
// to recurse.
|
|
326
327
|
({
|
|
327
328
|
content: {
|
|
328
329
|
__import: true,
|
|
@@ -485,7 +486,8 @@ export default async function pluginContentBlog(
|
|
|
485
486
|
// Blog posts title are rendered separately
|
|
486
487
|
removeContentTitle: true,
|
|
487
488
|
|
|
488
|
-
// Assets allow to convert some relative images paths to
|
|
489
|
+
// Assets allow to convert some relative images paths to
|
|
490
|
+
// require() calls
|
|
489
491
|
createAssets: ({
|
|
490
492
|
frontMatter,
|
|
491
493
|
metadata,
|