@docusaurus/plugin-content-blog 0.0.0-5985 → 0.0.0-5988
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/props.d.ts +5 -1
- package/lib/props.js +12 -0
- package/lib/routes.js +5 -9
- package/package.json +9 -9
- package/src/plugin-content-blog.d.ts +1 -0
- package/src/props.ts +24 -1
- package/src/routes.ts +6 -11
package/lib/props.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type { TagsListItem, TagModule } from '@docusaurus/utils';
|
|
8
|
-
import type { BlogTag, BlogTags } from '@docusaurus/plugin-content-blog';
|
|
8
|
+
import type { BlogPost, BlogSidebar, BlogTag, BlogTags } from '@docusaurus/plugin-content-blog';
|
|
9
9
|
export declare function toTagsProp({ blogTags }: {
|
|
10
10
|
blogTags: BlogTags;
|
|
11
11
|
}): TagsListItem[];
|
|
@@ -13,3 +13,7 @@ export declare function toTagProp({ blogTagsListPath, tag, }: {
|
|
|
13
13
|
blogTagsListPath: string;
|
|
14
14
|
tag: BlogTag;
|
|
15
15
|
}): TagModule;
|
|
16
|
+
export declare function toBlogSidebarProp({ blogSidebarTitle, blogPosts, }: {
|
|
17
|
+
blogSidebarTitle: string;
|
|
18
|
+
blogPosts: BlogPost[];
|
|
19
|
+
}): BlogSidebar;
|
package/lib/props.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toTagsProp = toTagsProp;
|
|
4
4
|
exports.toTagProp = toTagProp;
|
|
5
|
+
exports.toBlogSidebarProp = toBlogSidebarProp;
|
|
5
6
|
function toTagsProp({ blogTags }) {
|
|
6
7
|
return Object.values(blogTags)
|
|
7
8
|
.filter((tag) => !tag.unlisted)
|
|
@@ -22,3 +23,14 @@ function toTagProp({ blogTagsListPath, tag, }) {
|
|
|
22
23
|
unlisted: tag.unlisted,
|
|
23
24
|
};
|
|
24
25
|
}
|
|
26
|
+
function toBlogSidebarProp({ blogSidebarTitle, blogPosts, }) {
|
|
27
|
+
return {
|
|
28
|
+
title: blogSidebarTitle,
|
|
29
|
+
items: blogPosts.map((blogPost) => ({
|
|
30
|
+
title: blogPost.metadata.title,
|
|
31
|
+
permalink: blogPost.metadata.permalink,
|
|
32
|
+
unlisted: blogPost.metadata.unlisted,
|
|
33
|
+
date: blogPost.metadata.date,
|
|
34
|
+
})),
|
|
35
|
+
};
|
|
36
|
+
}
|
package/lib/routes.js
CHANGED
|
@@ -35,15 +35,11 @@ async function buildAllRoutes({ baseUrl, content, actions, options, aliasedSourc
|
|
|
35
35
|
? blogPosts
|
|
36
36
|
: blogPosts.slice(0, options.blogSidebarCount);
|
|
37
37
|
async function createSidebarModule() {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
unlisted: blogPost.metadata.unlisted,
|
|
44
|
-
})),
|
|
45
|
-
};
|
|
46
|
-
const modulePath = await createData(`blog-post-list-prop-${pluginId}.json`, sidebar);
|
|
38
|
+
const sidebarProp = (0, props_1.toBlogSidebarProp)({
|
|
39
|
+
blogSidebarTitle,
|
|
40
|
+
blogPosts: sidebarBlogPosts,
|
|
41
|
+
});
|
|
42
|
+
const modulePath = await createData(`blog-post-list-prop-${pluginId}.json`, sidebarProp);
|
|
47
43
|
return aliasedSource(modulePath);
|
|
48
44
|
}
|
|
49
45
|
async function createBlogMetadataModule() {
|
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-5988",
|
|
4
4
|
"description": "Blog plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/plugin-content-blog.d.ts",
|
|
@@ -31,13 +31,13 @@
|
|
|
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/types": "0.0.0-
|
|
38
|
-
"@docusaurus/utils": "0.0.0-
|
|
39
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
40
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
34
|
+
"@docusaurus/core": "0.0.0-5988",
|
|
35
|
+
"@docusaurus/logger": "0.0.0-5988",
|
|
36
|
+
"@docusaurus/mdx-loader": "0.0.0-5988",
|
|
37
|
+
"@docusaurus/types": "0.0.0-5988",
|
|
38
|
+
"@docusaurus/utils": "0.0.0-5988",
|
|
39
|
+
"@docusaurus/utils-common": "0.0.0-5988",
|
|
40
|
+
"@docusaurus/utils-validation": "0.0.0-5988",
|
|
41
41
|
"cheerio": "^1.0.0-rc.12",
|
|
42
42
|
"feed": "^4.2.2",
|
|
43
43
|
"fs-extra": "^11.1.1",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@total-typescript/shoehorn": "^0.1.2"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "d0fdafd91649c846567d686ec00d3ff6ae494556"
|
|
63
63
|
}
|
package/src/props.ts
CHANGED
|
@@ -5,7 +5,12 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type {TagsListItem, TagModule} from '@docusaurus/utils';
|
|
8
|
-
import type {
|
|
8
|
+
import type {
|
|
9
|
+
BlogPost,
|
|
10
|
+
BlogSidebar,
|
|
11
|
+
BlogTag,
|
|
12
|
+
BlogTags,
|
|
13
|
+
} from '@docusaurus/plugin-content-blog';
|
|
9
14
|
|
|
10
15
|
export function toTagsProp({blogTags}: {blogTags: BlogTags}): TagsListItem[] {
|
|
11
16
|
return Object.values(blogTags)
|
|
@@ -34,3 +39,21 @@ export function toTagProp({
|
|
|
34
39
|
unlisted: tag.unlisted,
|
|
35
40
|
};
|
|
36
41
|
}
|
|
42
|
+
|
|
43
|
+
export function toBlogSidebarProp({
|
|
44
|
+
blogSidebarTitle,
|
|
45
|
+
blogPosts,
|
|
46
|
+
}: {
|
|
47
|
+
blogSidebarTitle: string;
|
|
48
|
+
blogPosts: BlogPost[];
|
|
49
|
+
}): BlogSidebar {
|
|
50
|
+
return {
|
|
51
|
+
title: blogSidebarTitle,
|
|
52
|
+
items: blogPosts.map((blogPost) => ({
|
|
53
|
+
title: blogPost.metadata.title,
|
|
54
|
+
permalink: blogPost.metadata.permalink,
|
|
55
|
+
unlisted: blogPost.metadata.unlisted,
|
|
56
|
+
date: blogPost.metadata.date,
|
|
57
|
+
})),
|
|
58
|
+
};
|
|
59
|
+
}
|
package/src/routes.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from '@docusaurus/utils';
|
|
14
14
|
import {shouldBeListed} from './blogUtils';
|
|
15
15
|
|
|
16
|
-
import {toTagProp, toTagsProp} from './props';
|
|
16
|
+
import {toBlogSidebarProp, toTagProp, toTagsProp} from './props';
|
|
17
17
|
import type {
|
|
18
18
|
PluginContentLoadedActions,
|
|
19
19
|
RouteConfig,
|
|
@@ -26,7 +26,6 @@ import type {
|
|
|
26
26
|
BlogContent,
|
|
27
27
|
PluginOptions,
|
|
28
28
|
BlogPost,
|
|
29
|
-
BlogSidebar,
|
|
30
29
|
} from '@docusaurus/plugin-content-blog';
|
|
31
30
|
|
|
32
31
|
type CreateAllRoutesParam = {
|
|
@@ -88,17 +87,13 @@ export async function buildAllRoutes({
|
|
|
88
87
|
: blogPosts.slice(0, options.blogSidebarCount);
|
|
89
88
|
|
|
90
89
|
async function createSidebarModule() {
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
permalink: blogPost.metadata.permalink,
|
|
96
|
-
unlisted: blogPost.metadata.unlisted,
|
|
97
|
-
})),
|
|
98
|
-
};
|
|
90
|
+
const sidebarProp = toBlogSidebarProp({
|
|
91
|
+
blogSidebarTitle,
|
|
92
|
+
blogPosts: sidebarBlogPosts,
|
|
93
|
+
});
|
|
99
94
|
const modulePath = await createData(
|
|
100
95
|
`blog-post-list-prop-${pluginId}.json`,
|
|
101
|
-
|
|
96
|
+
sidebarProp,
|
|
102
97
|
);
|
|
103
98
|
return aliasedSource(modulePath);
|
|
104
99
|
}
|