@docusaurus/plugin-content-blog 0.0.0-6065 → 0.0.0-6067
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/index.js +12 -13
- package/package.json +10 -10
- package/src/index.ts +16 -25
package/lib/index.js
CHANGED
|
@@ -70,23 +70,22 @@ async function pluginContentBlog(context, options) {
|
|
|
70
70
|
// Note that metadataPath must be the same/in-sync as
|
|
71
71
|
// the path from createData for each MDX.
|
|
72
72
|
const aliasedPath = (0, utils_1.aliasedSitePath)(mdxPath, siteDir);
|
|
73
|
-
|
|
74
|
-
const metadataContent = contentHelpers.sourceToBlogPost.get(aliasedPath).metadata;
|
|
75
|
-
return {
|
|
76
|
-
metadataPath,
|
|
77
|
-
metadataContent,
|
|
78
|
-
};
|
|
73
|
+
return path_1.default.join(dataDir, `${(0, utils_1.docuHash)(aliasedPath)}.json`);
|
|
79
74
|
},
|
|
80
75
|
// For blog posts a title in markdown is always removed
|
|
81
76
|
// Blog posts title are rendered separately
|
|
82
77
|
removeContentTitle: true,
|
|
83
|
-
//
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
78
|
+
// createAssets converts relative paths to require() calls
|
|
79
|
+
createAssets: ({ filePath }) => {
|
|
80
|
+
const blogPost = contentHelpers.sourceToBlogPost.get((0, utils_1.aliasedSitePath)(filePath, siteDir));
|
|
81
|
+
if (!blogPost) {
|
|
82
|
+
throw new Error(`Blog post not found for filePath=${filePath}`);
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
image: blogPost.metadata.frontMatter.image,
|
|
86
|
+
authorsImageUrls: blogPost.metadata.authors.map((author) => author.imageURL),
|
|
87
|
+
};
|
|
88
|
+
},
|
|
90
89
|
markdownConfig: siteConfig.markdown,
|
|
91
90
|
resolveMarkdownLink: ({ linkPathname, sourceFilePath }) => {
|
|
92
91
|
const permalink = (0, utils_1.resolveMarkdownLinkPathname)(linkPathname, {
|
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-6067",
|
|
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": "0.0.0-
|
|
35
|
-
"@docusaurus/logger": "0.0.0-
|
|
36
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
37
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
38
|
-
"@docusaurus/types": "0.0.0-
|
|
39
|
-
"@docusaurus/utils": "0.0.0-
|
|
40
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
41
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
34
|
+
"@docusaurus/core": "0.0.0-6067",
|
|
35
|
+
"@docusaurus/logger": "0.0.0-6067",
|
|
36
|
+
"@docusaurus/mdx-loader": "0.0.0-6067",
|
|
37
|
+
"@docusaurus/theme-common": "0.0.0-6067",
|
|
38
|
+
"@docusaurus/types": "0.0.0-6067",
|
|
39
|
+
"@docusaurus/utils": "0.0.0-6067",
|
|
40
|
+
"@docusaurus/utils-common": "0.0.0-6067",
|
|
41
|
+
"@docusaurus/utils-validation": "0.0.0-6067",
|
|
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": "856911a5474e8e907f83438abe5c42d4793e06cb"
|
|
66
66
|
}
|
package/src/index.ts
CHANGED
|
@@ -44,8 +44,6 @@ import type {BlogContentPaths, BlogMarkdownLoaderOptions} from './types';
|
|
|
44
44
|
import type {LoadContext, Plugin} from '@docusaurus/types';
|
|
45
45
|
import type {
|
|
46
46
|
PluginOptions,
|
|
47
|
-
BlogPostFrontMatter,
|
|
48
|
-
BlogPostMetadata,
|
|
49
47
|
Assets,
|
|
50
48
|
BlogTags,
|
|
51
49
|
BlogContent,
|
|
@@ -135,33 +133,26 @@ export default async function pluginContentBlog(
|
|
|
135
133
|
// Note that metadataPath must be the same/in-sync as
|
|
136
134
|
// the path from createData for each MDX.
|
|
137
135
|
const aliasedPath = aliasedSitePath(mdxPath, siteDir);
|
|
138
|
-
|
|
139
|
-
dataDir,
|
|
140
|
-
`${docuHash(aliasedPath)}.json`,
|
|
141
|
-
);
|
|
142
|
-
const metadataContent =
|
|
143
|
-
contentHelpers.sourceToBlogPost.get(aliasedPath)!.metadata;
|
|
144
|
-
return {
|
|
145
|
-
metadataPath,
|
|
146
|
-
metadataContent,
|
|
147
|
-
};
|
|
136
|
+
return path.join(dataDir, `${docuHash(aliasedPath)}.json`);
|
|
148
137
|
},
|
|
149
138
|
// For blog posts a title in markdown is always removed
|
|
150
139
|
// Blog posts title are rendered separately
|
|
151
140
|
removeContentTitle: true,
|
|
152
|
-
//
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
141
|
+
// createAssets converts relative paths to require() calls
|
|
142
|
+
createAssets: ({filePath}: {filePath: string}): Assets => {
|
|
143
|
+
const blogPost = contentHelpers.sourceToBlogPost.get(
|
|
144
|
+
aliasedSitePath(filePath, siteDir),
|
|
145
|
+
)!;
|
|
146
|
+
if (!blogPost) {
|
|
147
|
+
throw new Error(`Blog post not found for filePath=${filePath}`);
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
image: blogPost.metadata.frontMatter.image as string,
|
|
151
|
+
authorsImageUrls: blogPost.metadata.authors.map(
|
|
152
|
+
(author) => author.imageURL,
|
|
153
|
+
),
|
|
154
|
+
};
|
|
155
|
+
},
|
|
165
156
|
markdownConfig: siteConfig.markdown,
|
|
166
157
|
resolveMarkdownLink: ({linkPathname, sourceFilePath}) => {
|
|
167
158
|
const permalink = resolveMarkdownLinkPathname(linkPathname, {
|