@docusaurus/plugin-content-blog 3.6.3 → 3.7.0
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/authorsSocials.js +12 -0
- package/lib/client/contexts.d.ts +1 -1
- package/lib/frontMatter.js +2 -1
- package/lib/props.js +1 -1
- package/package.json +12 -12
- package/src/authorsSocials.ts +12 -0
- package/src/client/contexts.tsx +1 -1
- package/src/frontMatter.ts +2 -1
- package/src/plugin-content-blog.d.ts +33 -12
- package/src/props.ts +2 -1
package/lib/authorsSocials.js
CHANGED
|
@@ -17,6 +17,12 @@ exports.AuthorSocialsSchema = utils_validation_1.Joi.object({
|
|
|
17
17
|
.try(utils_validation_1.Joi.number(), utils_validation_1.Joi.string())
|
|
18
18
|
.custom((val) => String(val)),
|
|
19
19
|
x: utils_validation_1.Joi.string(),
|
|
20
|
+
bluesky: utils_validation_1.Joi.string(),
|
|
21
|
+
instagram: utils_validation_1.Joi.string(),
|
|
22
|
+
threads: utils_validation_1.Joi.string(),
|
|
23
|
+
mastodon: utils_validation_1.Joi.string(),
|
|
24
|
+
twitch: utils_validation_1.Joi.string(),
|
|
25
|
+
youtube: utils_validation_1.Joi.string(),
|
|
20
26
|
}).unknown();
|
|
21
27
|
const PredefinedPlatformNormalizers = {
|
|
22
28
|
x: (handle) => `https://x.com/${handle}`,
|
|
@@ -24,6 +30,12 @@ const PredefinedPlatformNormalizers = {
|
|
|
24
30
|
github: (handle) => `https://github.com/${handle}`,
|
|
25
31
|
linkedin: (handle) => `https://www.linkedin.com/in/${handle}/`,
|
|
26
32
|
stackoverflow: (userId) => `https://stackoverflow.com/users/${userId}`,
|
|
33
|
+
bluesky: (handle) => `https://bsky.app/profile/${handle}`,
|
|
34
|
+
instagram: (handle) => `https://www.instagram.com/${handle}`,
|
|
35
|
+
threads: (handle) => `https://www.threads.net/@${handle}`,
|
|
36
|
+
mastodon: (handle) => `https://mastodon.social/@${handle}`, // can be in format user@other.server and it will redirect if needed
|
|
37
|
+
twitch: (handle) => `https://twitch.tv/${handle}`,
|
|
38
|
+
youtube: (handle) => `https://youtube.com/@${handle}`, // https://support.google.com/youtube/answer/6180214?hl=en
|
|
27
39
|
};
|
|
28
40
|
function normalizeSocialEntry([platform, value]) {
|
|
29
41
|
const normalizer = PredefinedPlatformNormalizers[platform.toLowerCase()];
|
package/lib/client/contexts.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare function BlogPostProvider({ children, content, isBlogPostPage, }:
|
|
|
22
22
|
children: ReactNode;
|
|
23
23
|
content: PropBlogPostContent;
|
|
24
24
|
isBlogPostPage?: boolean;
|
|
25
|
-
}):
|
|
25
|
+
}): ReactNode;
|
|
26
26
|
/**
|
|
27
27
|
* Returns the data of the currently browsed blog post. Gives access to
|
|
28
28
|
* front matter, metadata, TOC, etc.
|
package/lib/frontMatter.js
CHANGED
|
@@ -23,7 +23,8 @@ const FrontMatterAuthorErrorMessage = '{{#label}} does not look like a valid blo
|
|
|
23
23
|
const BlogFrontMatterSchema = utils_validation_1.JoiFrontMatter.object({
|
|
24
24
|
id: utils_validation_1.JoiFrontMatter.string(),
|
|
25
25
|
title: utils_validation_1.JoiFrontMatter.string().allow(''),
|
|
26
|
-
title_meta: utils_validation_1.JoiFrontMatter.string(),
|
|
26
|
+
title_meta: utils_validation_1.JoiFrontMatter.string().allow(''),
|
|
27
|
+
sidebar_label: utils_validation_1.JoiFrontMatter.string().allow(''),
|
|
27
28
|
description: utils_validation_1.JoiFrontMatter.string().allow(''),
|
|
28
29
|
tags: utils_validation_1.FrontMatterTagsSchema,
|
|
29
30
|
date: utils_validation_1.JoiFrontMatter.date().raw(),
|
package/lib/props.js
CHANGED
|
@@ -34,7 +34,7 @@ function toBlogSidebarProp({ blogSidebarTitle, blogPosts, }) {
|
|
|
34
34
|
return {
|
|
35
35
|
title: blogSidebarTitle,
|
|
36
36
|
items: blogPosts.map((blogPost) => ({
|
|
37
|
-
title: blogPost.metadata.title,
|
|
37
|
+
title: blogPost.metadata.frontMatter.sidebar_label ?? blogPost.metadata.title,
|
|
38
38
|
permalink: blogPost.metadata.permalink,
|
|
39
39
|
unlisted: blogPost.metadata.unlisted,
|
|
40
40
|
date: blogPost.metadata.date,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-blog",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
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.
|
|
35
|
-
"@docusaurus/logger": "3.
|
|
36
|
-
"@docusaurus/mdx-loader": "3.
|
|
37
|
-
"@docusaurus/theme-common": "3.
|
|
38
|
-
"@docusaurus/types": "3.
|
|
39
|
-
"@docusaurus/utils": "3.
|
|
40
|
-
"@docusaurus/utils-common": "3.
|
|
41
|
-
"@docusaurus/utils-validation": "3.
|
|
34
|
+
"@docusaurus/core": "3.7.0",
|
|
35
|
+
"@docusaurus/logger": "3.7.0",
|
|
36
|
+
"@docusaurus/mdx-loader": "3.7.0",
|
|
37
|
+
"@docusaurus/theme-common": "3.7.0",
|
|
38
|
+
"@docusaurus/types": "3.7.0",
|
|
39
|
+
"@docusaurus/utils": "3.7.0",
|
|
40
|
+
"@docusaurus/utils-common": "3.7.0",
|
|
41
|
+
"@docusaurus/utils-validation": "3.7.0",
|
|
42
42
|
"cheerio": "1.0.0-rc.12",
|
|
43
43
|
"feed": "^4.2.2",
|
|
44
44
|
"fs-extra": "^11.1.1",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@docusaurus/plugin-content-docs": "*",
|
|
55
|
-
"react": "^18.0.0",
|
|
56
|
-
"react-dom": "^18.0.0"
|
|
55
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
56
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">=18.0"
|
|
@@ -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": "dd59750c16fe6908a26f18806a54d4c3dbe6db43"
|
|
66
66
|
}
|
package/src/authorsSocials.ts
CHANGED
|
@@ -21,6 +21,12 @@ export const AuthorSocialsSchema = Joi.object<AuthorSocials>({
|
|
|
21
21
|
.try(Joi.number(), Joi.string())
|
|
22
22
|
.custom((val) => String(val)),
|
|
23
23
|
x: Joi.string(),
|
|
24
|
+
bluesky: Joi.string(),
|
|
25
|
+
instagram: Joi.string(),
|
|
26
|
+
threads: Joi.string(),
|
|
27
|
+
mastodon: Joi.string(),
|
|
28
|
+
twitch: Joi.string(),
|
|
29
|
+
youtube: Joi.string(),
|
|
24
30
|
}).unknown();
|
|
25
31
|
|
|
26
32
|
type PredefinedPlatformNormalizer = (value: string) => string;
|
|
@@ -35,6 +41,12 @@ const PredefinedPlatformNormalizers: Record<
|
|
|
35
41
|
linkedin: (handle: string) => `https://www.linkedin.com/in/${handle}/`,
|
|
36
42
|
stackoverflow: (userId: string) =>
|
|
37
43
|
`https://stackoverflow.com/users/${userId}`,
|
|
44
|
+
bluesky: (handle: string) => `https://bsky.app/profile/${handle}`,
|
|
45
|
+
instagram: (handle: string) => `https://www.instagram.com/${handle}`,
|
|
46
|
+
threads: (handle: string) => `https://www.threads.net/@${handle}`,
|
|
47
|
+
mastodon: (handle: string) => `https://mastodon.social/@${handle}`, // can be in format user@other.server and it will redirect if needed
|
|
48
|
+
twitch: (handle: string) => `https://twitch.tv/${handle}`,
|
|
49
|
+
youtube: (handle: string) => `https://youtube.com/@${handle}`, // https://support.google.com/youtube/answer/6180214?hl=en
|
|
38
50
|
};
|
|
39
51
|
|
|
40
52
|
type SocialEntry = [string, string];
|
package/src/client/contexts.tsx
CHANGED
|
@@ -74,7 +74,7 @@ export function BlogPostProvider({
|
|
|
74
74
|
children: ReactNode;
|
|
75
75
|
content: PropBlogPostContent;
|
|
76
76
|
isBlogPostPage?: boolean;
|
|
77
|
-
}):
|
|
77
|
+
}): ReactNode {
|
|
78
78
|
const contextValue = useContextValue({content, isBlogPostPage});
|
|
79
79
|
return <Context.Provider value={contextValue}>{children}</Context.Provider>;
|
|
80
80
|
}
|
package/src/frontMatter.ts
CHANGED
|
@@ -33,7 +33,8 @@ const FrontMatterAuthorErrorMessage =
|
|
|
33
33
|
const BlogFrontMatterSchema = Joi.object<BlogPostFrontMatter>({
|
|
34
34
|
id: Joi.string(),
|
|
35
35
|
title: Joi.string().allow(''),
|
|
36
|
-
title_meta: Joi.string(),
|
|
36
|
+
title_meta: Joi.string().allow(''),
|
|
37
|
+
sidebar_label: Joi.string().allow(''),
|
|
37
38
|
description: Joi.string().allow(''),
|
|
38
39
|
tags: FrontMatterTagsSchema,
|
|
39
40
|
date: Joi.date().raw(),
|
|
@@ -46,7 +46,13 @@ declare module '@docusaurus/plugin-content-blog' {
|
|
|
46
46
|
| 'github'
|
|
47
47
|
| 'linkedin'
|
|
48
48
|
| 'stackoverflow'
|
|
49
|
-
| 'x'
|
|
49
|
+
| 'x'
|
|
50
|
+
| 'bluesky'
|
|
51
|
+
| 'instagram'
|
|
52
|
+
| 'threads'
|
|
53
|
+
| 'mastodon'
|
|
54
|
+
| 'youtube'
|
|
55
|
+
| 'twitch';
|
|
50
56
|
|
|
51
57
|
/**
|
|
52
58
|
* Social platforms of the author.
|
|
@@ -145,7 +151,6 @@ declare module '@docusaurus/plugin-content-blog' {
|
|
|
145
151
|
title?: string;
|
|
146
152
|
/**
|
|
147
153
|
* Will be used for SEO page metadata and override BlogPostMetadata.title.
|
|
148
|
-
* @see {@link BlogPostMetadata.title_meta}
|
|
149
154
|
*/
|
|
150
155
|
title_meta?: string;
|
|
151
156
|
/**
|
|
@@ -153,6 +158,10 @@ declare module '@docusaurus/plugin-content-blog' {
|
|
|
153
158
|
* @see {@link BlogPostMetadata.description}
|
|
154
159
|
*/
|
|
155
160
|
description?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Will override the default excerpt.
|
|
163
|
+
*/
|
|
164
|
+
sidebar_label?: string;
|
|
156
165
|
/**
|
|
157
166
|
* Front matter tags, unnormalized.
|
|
158
167
|
* @see {@link BlogPostMetadata.tags}
|
|
@@ -660,6 +669,7 @@ declare module '@docusaurus/plugin-content-blog' {
|
|
|
660
669
|
}
|
|
661
670
|
|
|
662
671
|
declare module '@theme/BlogPostPage' {
|
|
672
|
+
import type {ReactNode} from 'react';
|
|
663
673
|
import type {
|
|
664
674
|
BlogPostFrontMatter,
|
|
665
675
|
BlogSidebar,
|
|
@@ -680,18 +690,23 @@ declare module '@theme/BlogPostPage' {
|
|
|
680
690
|
readonly blogMetadata: BlogMetadata;
|
|
681
691
|
}
|
|
682
692
|
|
|
683
|
-
export default function BlogPostPage(props: Props):
|
|
693
|
+
export default function BlogPostPage(props: Props): ReactNode;
|
|
684
694
|
}
|
|
685
695
|
|
|
686
696
|
declare module '@theme/BlogPostPage/Metadata' {
|
|
687
|
-
|
|
697
|
+
import type {ReactNode} from 'react';
|
|
698
|
+
|
|
699
|
+
export default function BlogPostPageMetadata(): ReactNode;
|
|
688
700
|
}
|
|
689
701
|
|
|
690
702
|
declare module '@theme/BlogPostPage/StructuredData' {
|
|
691
|
-
|
|
703
|
+
import type {ReactNode} from 'react';
|
|
704
|
+
|
|
705
|
+
export default function BlogPostStructuredData(): ReactNode;
|
|
692
706
|
}
|
|
693
707
|
|
|
694
708
|
declare module '@theme/BlogListPage' {
|
|
709
|
+
import type {ReactNode} from 'react';
|
|
695
710
|
import type {Content} from '@theme/BlogPostPage';
|
|
696
711
|
import type {
|
|
697
712
|
BlogSidebar,
|
|
@@ -710,10 +725,11 @@ declare module '@theme/BlogListPage' {
|
|
|
710
725
|
readonly items: readonly {readonly content: Content}[];
|
|
711
726
|
}
|
|
712
727
|
|
|
713
|
-
export default function BlogListPage(props: Props):
|
|
728
|
+
export default function BlogListPage(props: Props): ReactNode;
|
|
714
729
|
}
|
|
715
730
|
|
|
716
731
|
declare module '@theme/BlogListPage/StructuredData' {
|
|
732
|
+
import type {ReactNode} from 'react';
|
|
717
733
|
import type {Content} from '@theme/BlogPostPage';
|
|
718
734
|
import type {
|
|
719
735
|
BlogSidebar,
|
|
@@ -732,10 +748,11 @@ declare module '@theme/BlogListPage/StructuredData' {
|
|
|
732
748
|
readonly items: readonly {readonly content: Content}[];
|
|
733
749
|
}
|
|
734
750
|
|
|
735
|
-
export default function BlogListPageStructuredData(props: Props):
|
|
751
|
+
export default function BlogListPageStructuredData(props: Props): ReactNode;
|
|
736
752
|
}
|
|
737
753
|
|
|
738
754
|
declare module '@theme/BlogTagsListPage' {
|
|
755
|
+
import type {ReactNode} from 'react';
|
|
739
756
|
import type {BlogSidebar} from '@docusaurus/plugin-content-blog';
|
|
740
757
|
import type {TagsListItem} from '@docusaurus/utils';
|
|
741
758
|
|
|
@@ -746,10 +763,11 @@ declare module '@theme/BlogTagsListPage' {
|
|
|
746
763
|
readonly tags: TagsListItem[];
|
|
747
764
|
}
|
|
748
765
|
|
|
749
|
-
export default function BlogTagsListPage(props: Props):
|
|
766
|
+
export default function BlogTagsListPage(props: Props): ReactNode;
|
|
750
767
|
}
|
|
751
768
|
|
|
752
769
|
declare module '@theme/Blog/Pages/BlogAuthorsListPage' {
|
|
770
|
+
import type {ReactNode} from 'react';
|
|
753
771
|
import type {
|
|
754
772
|
AuthorItemProp,
|
|
755
773
|
BlogSidebar,
|
|
@@ -762,10 +780,11 @@ declare module '@theme/Blog/Pages/BlogAuthorsListPage' {
|
|
|
762
780
|
readonly authors: AuthorItemProp[];
|
|
763
781
|
}
|
|
764
782
|
|
|
765
|
-
export default function BlogAuthorsListPage(props: Props):
|
|
783
|
+
export default function BlogAuthorsListPage(props: Props): ReactNode;
|
|
766
784
|
}
|
|
767
785
|
|
|
768
786
|
declare module '@theme/Blog/Pages/BlogAuthorsPostsPage' {
|
|
787
|
+
import type {ReactNode} from 'react';
|
|
769
788
|
import type {Content} from '@theme/BlogPostPage';
|
|
770
789
|
import type {
|
|
771
790
|
AuthorItemProp,
|
|
@@ -787,10 +806,11 @@ declare module '@theme/Blog/Pages/BlogAuthorsPostsPage' {
|
|
|
787
806
|
readonly items: readonly {readonly content: Content}[];
|
|
788
807
|
}
|
|
789
808
|
|
|
790
|
-
export default function BlogAuthorsPostsPage(props: Props):
|
|
809
|
+
export default function BlogAuthorsPostsPage(props: Props): ReactNode;
|
|
791
810
|
}
|
|
792
811
|
|
|
793
812
|
declare module '@theme/BlogTagsPostsPage' {
|
|
813
|
+
import type {ReactNode} from 'react';
|
|
794
814
|
import type {Content} from '@theme/BlogPostPage';
|
|
795
815
|
import type {
|
|
796
816
|
BlogSidebar,
|
|
@@ -812,10 +832,11 @@ declare module '@theme/BlogTagsPostsPage' {
|
|
|
812
832
|
readonly items: readonly {readonly content: Content}[];
|
|
813
833
|
}
|
|
814
834
|
|
|
815
|
-
export default function BlogTagsPostsPage(props: Props):
|
|
835
|
+
export default function BlogTagsPostsPage(props: Props): ReactNode;
|
|
816
836
|
}
|
|
817
837
|
|
|
818
838
|
declare module '@theme/BlogArchivePage' {
|
|
839
|
+
import type {ReactNode} from 'react';
|
|
819
840
|
import type {Content} from '@theme/BlogPostPage';
|
|
820
841
|
|
|
821
842
|
/** We may add extra metadata or prune some metadata from here */
|
|
@@ -829,5 +850,5 @@ declare module '@theme/BlogArchivePage' {
|
|
|
829
850
|
};
|
|
830
851
|
}
|
|
831
852
|
|
|
832
|
-
export default function BlogArchivePage(props: Props):
|
|
853
|
+
export default function BlogArchivePage(props: Props): ReactNode;
|
|
833
854
|
}
|
package/src/props.ts
CHANGED
|
@@ -65,7 +65,8 @@ export function toBlogSidebarProp({
|
|
|
65
65
|
return {
|
|
66
66
|
title: blogSidebarTitle,
|
|
67
67
|
items: blogPosts.map((blogPost) => ({
|
|
68
|
-
title:
|
|
68
|
+
title:
|
|
69
|
+
blogPost.metadata.frontMatter.sidebar_label ?? blogPost.metadata.title,
|
|
69
70
|
permalink: blogPost.metadata.permalink,
|
|
70
71
|
unlisted: blogPost.metadata.unlisted,
|
|
71
72
|
date: blogPost.metadata.date,
|