@docusaurus/theme-classic 0.0.0-5183 → 0.0.0-5184
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/theme/BlogListPage/index.js +2 -11
- package/lib/theme/BlogPostItem/Container/index.d.ts +9 -0
- package/lib/theme/BlogPostItem/Container/index.js +26 -0
- package/lib/theme/BlogPostItem/Content/index.d.ts +9 -0
- package/lib/theme/BlogPostItem/Content/index.js +23 -0
- package/lib/theme/BlogPostItem/Footer/ReadMoreLink/index.d.ts +9 -0
- package/lib/theme/BlogPostItem/Footer/ReadMoreLink/index.js +38 -0
- package/lib/theme/{BlogPostAuthor → BlogPostItem/Footer}/index.d.ts +1 -2
- package/lib/theme/BlogPostItem/Footer/index.js +52 -0
- package/lib/theme/BlogPostItem/Footer/styles.module.css +10 -0
- package/lib/theme/BlogPostItem/Header/Author/index.d.ts +9 -0
- package/lib/theme/{BlogPostAuthor → BlogPostItem/Header/Author}/index.js +3 -2
- package/lib/theme/BlogPostItem/Header/Authors/index.d.ts +9 -0
- package/{src/theme/BlogPostAuthors/index.tsx → lib/theme/BlogPostItem/Header/Authors/index.js} +9 -10
- package/lib/theme/{BlogPostAuthors → BlogPostItem/Header/Authors}/styles.module.css +0 -0
- package/lib/theme/BlogPostItem/Header/Info/index.d.ts +9 -0
- package/lib/theme/BlogPostItem/Header/Info/index.js +60 -0
- package/lib/theme/BlogPostItem/Header/Info/styles.module.css +10 -0
- package/lib/theme/BlogPostItem/Header/Title/index.d.ts +9 -0
- package/lib/theme/BlogPostItem/Header/Title/index.js +27 -0
- package/{src/theme/BlogPostItem → lib/theme/BlogPostItem/Header/Title}/styles.module.css +2 -10
- package/lib/theme/{BlogPostAuthors → BlogPostItem/Header}/index.d.ts +1 -2
- package/lib/theme/BlogPostItem/Header/index.js +19 -0
- package/lib/theme/BlogPostItem/index.d.ts +1 -1
- package/lib/theme/BlogPostItem/index.js +16 -142
- package/lib/theme/BlogPostItems/index.d.ts +9 -0
- package/lib/theme/BlogPostItems/index.js +27 -0
- package/lib/theme/BlogPostPage/Metadata/index.d.ts +8 -0
- package/lib/theme/BlogPostPage/Metadata/index.js +41 -0
- package/lib/theme/BlogPostPage/index.js +21 -58
- package/lib/theme/BlogTagsPostsPage/index.d.ts +1 -1
- package/lib/theme/BlogTagsPostsPage/index.js +36 -30
- package/package.json +14 -14
- package/src/theme/BlogListPage/index.tsx +2 -11
- package/src/theme/BlogPostItem/Container/index.tsx +32 -0
- package/src/theme/BlogPostItem/Content/index.tsx +29 -0
- package/src/theme/BlogPostItem/Footer/ReadMoreLink/index.tsx +44 -0
- package/src/theme/BlogPostItem/Footer/index.tsx +60 -0
- package/src/theme/BlogPostItem/Footer/styles.module.css +10 -0
- package/src/theme/{BlogPostAuthor → BlogPostItem/Header/Author}/index.tsx +8 -3
- package/{lib/theme/BlogPostAuthors/index.js → src/theme/BlogPostItem/Header/Authors/index.tsx} +14 -3
- package/src/theme/{BlogPostAuthors → BlogPostItem/Header/Authors}/styles.module.css +0 -0
- package/src/theme/BlogPostItem/Header/Info/index.tsx +71 -0
- package/src/theme/BlogPostItem/Header/Info/styles.module.css +10 -0
- package/src/theme/BlogPostItem/Header/Title/index.tsx +33 -0
- package/{lib/theme/BlogPostItem → src/theme/BlogPostItem/Header/Title}/styles.module.css +2 -10
- package/src/theme/BlogPostItem/Header/index.tsx +21 -0
- package/src/theme/BlogPostItem/index.tsx +19 -145
- package/src/theme/BlogPostItems/index.tsx +30 -0
- package/src/theme/BlogPostPage/Metadata/index.tsx +44 -0
- package/src/theme/BlogPostPage/index.tsx +29 -60
- package/src/theme/BlogTagsPostsPage/index.tsx +42 -35
- package/src/theme-classic.d.ts +80 -18
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
import type { Props } from '@theme/BlogPostItems';
|
|
9
|
+
export default function BlogPostItems({ items, component: BlogPostItemComponent, }: Props): JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import {BlogPostProvider} from '@docusaurus/theme-common/internal';
|
|
9
|
+
import BlogPostItem from '@theme/BlogPostItem';
|
|
10
|
+
export default function BlogPostItems({
|
|
11
|
+
items,
|
|
12
|
+
component: BlogPostItemComponent = BlogPostItem,
|
|
13
|
+
}) {
|
|
14
|
+
return (
|
|
15
|
+
<>
|
|
16
|
+
{items.map(({content: BlogPostContent}) => (
|
|
17
|
+
<BlogPostProvider
|
|
18
|
+
key={BlogPostContent.metadata.permalink}
|
|
19
|
+
content={BlogPostContent}>
|
|
20
|
+
<BlogPostItemComponent>
|
|
21
|
+
<BlogPostContent />
|
|
22
|
+
</BlogPostItemComponent>
|
|
23
|
+
</BlogPostProvider>
|
|
24
|
+
))}
|
|
25
|
+
</>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
export default function BlogPostPageMetadata(): JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import {PageMetadata} from '@docusaurus/theme-common';
|
|
9
|
+
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
10
|
+
export default function BlogPostPageMetadata() {
|
|
11
|
+
const {assets, metadata} = useBlogPost();
|
|
12
|
+
const {title, description, date, tags, authors, frontMatter} = metadata;
|
|
13
|
+
const {keywords} = frontMatter;
|
|
14
|
+
const image = assets.image ?? frontMatter.image;
|
|
15
|
+
return (
|
|
16
|
+
<PageMetadata
|
|
17
|
+
title={title}
|
|
18
|
+
description={description}
|
|
19
|
+
keywords={keywords}
|
|
20
|
+
image={image}>
|
|
21
|
+
<meta property="og:type" content="article" />
|
|
22
|
+
<meta property="article:published_time" content={date} />
|
|
23
|
+
{/* TODO double check those article meta array syntaxes, see https://ogp.me/#array */}
|
|
24
|
+
{authors.some((author) => author.url) && (
|
|
25
|
+
<meta
|
|
26
|
+
property="article:author"
|
|
27
|
+
content={authors
|
|
28
|
+
.map((author) => author.url)
|
|
29
|
+
.filter(Boolean)
|
|
30
|
+
.join(',')}
|
|
31
|
+
/>
|
|
32
|
+
)}
|
|
33
|
+
{tags.length > 0 && (
|
|
34
|
+
<meta
|
|
35
|
+
property="article:tag"
|
|
36
|
+
content={tags.map((tag) => tag.label).join(',')}
|
|
37
|
+
/>
|
|
38
|
+
)}
|
|
39
|
+
</PageMetadata>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -6,51 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
HtmlClassNameProvider,
|
|
12
|
-
ThemeClassNames,
|
|
13
|
-
} from '@docusaurus/theme-common';
|
|
9
|
+
import {HtmlClassNameProvider, ThemeClassNames} from '@docusaurus/theme-common';
|
|
10
|
+
import {BlogPostProvider, useBlogPost} from '@docusaurus/theme-common/internal';
|
|
14
11
|
import BlogLayout from '@theme/BlogLayout';
|
|
15
12
|
import BlogPostItem from '@theme/BlogPostItem';
|
|
16
13
|
import BlogPostPaginator from '@theme/BlogPostPaginator';
|
|
14
|
+
import BlogPostPageMetadata from '@theme/BlogPostPage/Metadata';
|
|
17
15
|
import TOC from '@theme/TOC';
|
|
18
|
-
function
|
|
19
|
-
const {
|
|
20
|
-
const {assets, metadata} = BlogPostContents;
|
|
21
|
-
const {title, description, date, tags, authors, frontMatter} = metadata;
|
|
22
|
-
const {keywords} = frontMatter;
|
|
23
|
-
const image = assets.image ?? frontMatter.image;
|
|
24
|
-
return (
|
|
25
|
-
<PageMetadata
|
|
26
|
-
title={title}
|
|
27
|
-
description={description}
|
|
28
|
-
keywords={keywords}
|
|
29
|
-
image={image}>
|
|
30
|
-
<meta property="og:type" content="article" />
|
|
31
|
-
<meta property="article:published_time" content={date} />
|
|
32
|
-
{/* TODO double check those article meta array syntaxes, see https://ogp.me/#array */}
|
|
33
|
-
{authors.some((author) => author.url) && (
|
|
34
|
-
<meta
|
|
35
|
-
property="article:author"
|
|
36
|
-
content={authors
|
|
37
|
-
.map((author) => author.url)
|
|
38
|
-
.filter(Boolean)
|
|
39
|
-
.join(',')}
|
|
40
|
-
/>
|
|
41
|
-
)}
|
|
42
|
-
{tags.length > 0 && (
|
|
43
|
-
<meta
|
|
44
|
-
property="article:tag"
|
|
45
|
-
content={tags.map((tag) => tag.label).join(',')}
|
|
46
|
-
/>
|
|
47
|
-
)}
|
|
48
|
-
</PageMetadata>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
function BlogPostPageContent(props) {
|
|
52
|
-
const {content: BlogPostContents, sidebar} = props;
|
|
53
|
-
const {assets, metadata} = BlogPostContents;
|
|
16
|
+
function BlogPostPageContent({sidebar, children}) {
|
|
17
|
+
const {metadata, toc} = useBlogPost();
|
|
54
18
|
const {nextItem, prevItem, frontMatter} = metadata;
|
|
55
19
|
const {
|
|
56
20
|
hide_table_of_contents: hideTableOfContents,
|
|
@@ -61,21 +25,15 @@ function BlogPostPageContent(props) {
|
|
|
61
25
|
<BlogLayout
|
|
62
26
|
sidebar={sidebar}
|
|
63
27
|
toc={
|
|
64
|
-
!hideTableOfContents &&
|
|
28
|
+
!hideTableOfContents && toc.length > 0 ? (
|
|
65
29
|
<TOC
|
|
66
|
-
toc={
|
|
30
|
+
toc={toc}
|
|
67
31
|
minHeadingLevel={tocMinHeadingLevel}
|
|
68
32
|
maxHeadingLevel={tocMaxHeadingLevel}
|
|
69
33
|
/>
|
|
70
34
|
) : undefined
|
|
71
35
|
}>
|
|
72
|
-
<BlogPostItem
|
|
73
|
-
frontMatter={frontMatter}
|
|
74
|
-
assets={assets}
|
|
75
|
-
metadata={metadata}
|
|
76
|
-
isBlogPostPage>
|
|
77
|
-
<BlogPostContents />
|
|
78
|
-
</BlogPostItem>
|
|
36
|
+
<BlogPostItem>{children}</BlogPostItem>
|
|
79
37
|
|
|
80
38
|
{(nextItem || prevItem) && (
|
|
81
39
|
<BlogPostPaginator nextItem={nextItem} prevItem={prevItem} />
|
|
@@ -84,14 +42,19 @@ function BlogPostPageContent(props) {
|
|
|
84
42
|
);
|
|
85
43
|
}
|
|
86
44
|
export default function BlogPostPage(props) {
|
|
45
|
+
const BlogPostContent = props.content;
|
|
87
46
|
return (
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
47
|
+
<BlogPostProvider content={props.content} isBlogPostPage>
|
|
48
|
+
<HtmlClassNameProvider
|
|
49
|
+
className={clsx(
|
|
50
|
+
ThemeClassNames.wrapper.blogPages,
|
|
51
|
+
ThemeClassNames.page.blogPostPage,
|
|
52
|
+
)}>
|
|
53
|
+
<BlogPostPageMetadata />
|
|
54
|
+
<BlogPostPageContent sidebar={props.sidebar}>
|
|
55
|
+
<BlogPostContent />
|
|
56
|
+
</BlogPostPageContent>
|
|
57
|
+
</HtmlClassNameProvider>
|
|
58
|
+
</BlogPostProvider>
|
|
96
59
|
);
|
|
97
60
|
}
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
/// <reference types="@docusaurus/plugin-content-blog" />
|
|
8
8
|
/// <reference types="react" />
|
|
9
9
|
import type { Props } from '@theme/BlogTagsPostsPage';
|
|
10
|
-
export default function BlogTagsPostsPage(
|
|
10
|
+
export default function BlogTagsPostsPage(props: Props): JSX.Element;
|
|
@@ -15,9 +15,9 @@ import {
|
|
|
15
15
|
} from '@docusaurus/theme-common';
|
|
16
16
|
import Link from '@docusaurus/Link';
|
|
17
17
|
import BlogLayout from '@theme/BlogLayout';
|
|
18
|
-
import BlogPostItem from '@theme/BlogPostItem';
|
|
19
18
|
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
20
19
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
20
|
+
import BlogPostItems from '@theme/BlogPostItems';
|
|
21
21
|
// Very simple pluralization: probably good enough for now
|
|
22
22
|
function useBlogPostsPlural() {
|
|
23
23
|
const {selectMessage} = usePluralForm();
|
|
@@ -35,9 +35,9 @@ function useBlogPostsPlural() {
|
|
|
35
35
|
),
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
function useBlogTagsPostsPageTitle(tag) {
|
|
39
39
|
const blogPostsPlural = useBlogPostsPlural();
|
|
40
|
-
|
|
40
|
+
return translate(
|
|
41
41
|
{
|
|
42
42
|
id: 'theme.blog.tagTitle',
|
|
43
43
|
description: 'The title of the page for a blog tag',
|
|
@@ -45,39 +45,45 @@ export default function BlogTagsPostsPage({tag, items, sidebar, listMetadata}) {
|
|
|
45
45
|
},
|
|
46
46
|
{nPosts: blogPostsPlural(tag.count), tagName: tag.label},
|
|
47
47
|
);
|
|
48
|
+
}
|
|
49
|
+
function BlogTagsPostsPageMetadata({tag}) {
|
|
50
|
+
const title = useBlogTagsPostsPageTitle(tag);
|
|
51
|
+
return (
|
|
52
|
+
<>
|
|
53
|
+
<PageMetadata title={title} />
|
|
54
|
+
<SearchMetadata tag="blog_tags_posts" />
|
|
55
|
+
</>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
function BlogTagsPostsPageContent({tag, items, sidebar, listMetadata}) {
|
|
59
|
+
const title = useBlogTagsPostsPageTitle(tag);
|
|
60
|
+
return (
|
|
61
|
+
<BlogLayout sidebar={sidebar}>
|
|
62
|
+
<header className="margin-bottom--xl">
|
|
63
|
+
<h1>{title}</h1>
|
|
64
|
+
|
|
65
|
+
<Link href={tag.allTagsPath}>
|
|
66
|
+
<Translate
|
|
67
|
+
id="theme.tags.tagsPageLink"
|
|
68
|
+
description="The label of the link targeting the tag list page">
|
|
69
|
+
View All Tags
|
|
70
|
+
</Translate>
|
|
71
|
+
</Link>
|
|
72
|
+
</header>
|
|
73
|
+
<BlogPostItems items={items} />
|
|
74
|
+
<BlogListPaginator metadata={listMetadata} />
|
|
75
|
+
</BlogLayout>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
export default function BlogTagsPostsPage(props) {
|
|
48
79
|
return (
|
|
49
80
|
<HtmlClassNameProvider
|
|
50
81
|
className={clsx(
|
|
51
82
|
ThemeClassNames.wrapper.blogPages,
|
|
52
83
|
ThemeClassNames.page.blogTagPostListPage,
|
|
53
84
|
)}>
|
|
54
|
-
<
|
|
55
|
-
<
|
|
56
|
-
<BlogLayout sidebar={sidebar}>
|
|
57
|
-
<header className="margin-bottom--xl">
|
|
58
|
-
<h1>{title}</h1>
|
|
59
|
-
|
|
60
|
-
<Link href={tag.allTagsPath}>
|
|
61
|
-
<Translate
|
|
62
|
-
id="theme.tags.tagsPageLink"
|
|
63
|
-
description="The label of the link targeting the tag list page">
|
|
64
|
-
View All Tags
|
|
65
|
-
</Translate>
|
|
66
|
-
</Link>
|
|
67
|
-
</header>
|
|
68
|
-
|
|
69
|
-
{items.map(({content: BlogPostContent}) => (
|
|
70
|
-
<BlogPostItem
|
|
71
|
-
key={BlogPostContent.metadata.permalink}
|
|
72
|
-
frontMatter={BlogPostContent.frontMatter}
|
|
73
|
-
assets={BlogPostContent.assets}
|
|
74
|
-
metadata={BlogPostContent.metadata}
|
|
75
|
-
truncated>
|
|
76
|
-
<BlogPostContent />
|
|
77
|
-
</BlogPostItem>
|
|
78
|
-
))}
|
|
79
|
-
<BlogListPaginator metadata={listMetadata} />
|
|
80
|
-
</BlogLayout>
|
|
85
|
+
<BlogTagsPostsPageMetadata {...props} />
|
|
86
|
+
<BlogTagsPostsPageContent {...props} />
|
|
81
87
|
</HtmlClassNameProvider>
|
|
82
88
|
);
|
|
83
89
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-5184",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -20,18 +20,18 @@
|
|
|
20
20
|
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@docusaurus/core": "0.0.0-
|
|
24
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
25
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
26
|
-
"@docusaurus/plugin-content-blog": "0.0.0-
|
|
27
|
-
"@docusaurus/plugin-content-docs": "0.0.0-
|
|
28
|
-
"@docusaurus/plugin-content-pages": "0.0.0-
|
|
29
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
30
|
-
"@docusaurus/theme-translations": "0.0.0-
|
|
31
|
-
"@docusaurus/types": "0.0.0-
|
|
32
|
-
"@docusaurus/utils": "0.0.0-
|
|
33
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
34
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
23
|
+
"@docusaurus/core": "0.0.0-5184",
|
|
24
|
+
"@docusaurus/mdx-loader": "0.0.0-5184",
|
|
25
|
+
"@docusaurus/module-type-aliases": "0.0.0-5184",
|
|
26
|
+
"@docusaurus/plugin-content-blog": "0.0.0-5184",
|
|
27
|
+
"@docusaurus/plugin-content-docs": "0.0.0-5184",
|
|
28
|
+
"@docusaurus/plugin-content-pages": "0.0.0-5184",
|
|
29
|
+
"@docusaurus/theme-common": "0.0.0-5184",
|
|
30
|
+
"@docusaurus/theme-translations": "0.0.0-5184",
|
|
31
|
+
"@docusaurus/types": "0.0.0-5184",
|
|
32
|
+
"@docusaurus/utils": "0.0.0-5184",
|
|
33
|
+
"@docusaurus/utils-common": "0.0.0-5184",
|
|
34
|
+
"@docusaurus/utils-validation": "0.0.0-5184",
|
|
35
35
|
"@mdx-js/react": "^1.6.22",
|
|
36
36
|
"clsx": "^1.2.0",
|
|
37
37
|
"copy-text-to-clipboard": "^3.0.1",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"engines": {
|
|
65
65
|
"node": ">=16.14"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "d6f6ee218b4fbba6d3a86ee4a7a89e2ec2b479b9"
|
|
68
68
|
}
|
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
ThemeClassNames,
|
|
16
16
|
} from '@docusaurus/theme-common';
|
|
17
17
|
import BlogLayout from '@theme/BlogLayout';
|
|
18
|
-
import BlogPostItem from '@theme/BlogPostItem';
|
|
19
18
|
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
20
19
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
21
20
|
import type {Props} from '@theme/BlogListPage';
|
|
21
|
+
import BlogPostItems from '@theme/BlogPostItems';
|
|
22
22
|
|
|
23
23
|
function BlogListPageMetadata(props: Props): JSX.Element {
|
|
24
24
|
const {metadata} = props;
|
|
@@ -40,16 +40,7 @@ function BlogListPageContent(props: Props): JSX.Element {
|
|
|
40
40
|
const {metadata, items, sidebar} = props;
|
|
41
41
|
return (
|
|
42
42
|
<BlogLayout sidebar={sidebar}>
|
|
43
|
-
{items
|
|
44
|
-
<BlogPostItem
|
|
45
|
-
key={BlogPostContent.metadata.permalink}
|
|
46
|
-
frontMatter={BlogPostContent.frontMatter}
|
|
47
|
-
assets={BlogPostContent.assets}
|
|
48
|
-
metadata={BlogPostContent.metadata}
|
|
49
|
-
truncated={BlogPostContent.metadata.truncated}>
|
|
50
|
-
<BlogPostContent />
|
|
51
|
-
</BlogPostItem>
|
|
52
|
-
))}
|
|
43
|
+
<BlogPostItems items={items} />
|
|
53
44
|
<BlogListPaginator metadata={metadata} />
|
|
54
45
|
</BlogLayout>
|
|
55
46
|
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
|
|
10
|
+
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
11
|
+
import type {Props} from '@theme/BlogPostItem/Container';
|
|
12
|
+
|
|
13
|
+
export default function BlogPostItemContainer({
|
|
14
|
+
children,
|
|
15
|
+
className,
|
|
16
|
+
}: Props): JSX.Element {
|
|
17
|
+
const {frontMatter, assets} = useBlogPost();
|
|
18
|
+
const {withBaseUrl} = useBaseUrlUtils();
|
|
19
|
+
const image = assets.image ?? frontMatter.image;
|
|
20
|
+
return (
|
|
21
|
+
<article
|
|
22
|
+
className={className}
|
|
23
|
+
itemProp="blogPost"
|
|
24
|
+
itemScope
|
|
25
|
+
itemType="http://schema.org/BlogPosting">
|
|
26
|
+
{image && (
|
|
27
|
+
<meta itemProp="image" content={withBaseUrl(image, {absolute: true})} />
|
|
28
|
+
)}
|
|
29
|
+
{children}
|
|
30
|
+
</article>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import {blogPostContainerID} from '@docusaurus/utils-common';
|
|
11
|
+
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
12
|
+
import MDXContent from '@theme/MDXContent';
|
|
13
|
+
import type {Props} from '@theme/BlogPostItem/Content';
|
|
14
|
+
|
|
15
|
+
export default function BlogPostItemContent({
|
|
16
|
+
children,
|
|
17
|
+
className,
|
|
18
|
+
}: Props): JSX.Element {
|
|
19
|
+
const {isBlogPostPage} = useBlogPost();
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
// This ID is used for the feed generation to locate the main content
|
|
23
|
+
id={isBlogPostPage ? blogPostContainerID : undefined}
|
|
24
|
+
className={clsx('markdown', className)}
|
|
25
|
+
itemProp="articleBody">
|
|
26
|
+
<MDXContent>{children}</MDXContent>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import Translate, {translate} from '@docusaurus/Translate';
|
|
10
|
+
import Link from '@docusaurus/Link';
|
|
11
|
+
import type {Props} from '@theme/BlogPostItem/Footer/ReadMoreLink';
|
|
12
|
+
|
|
13
|
+
function ReadMoreLabel() {
|
|
14
|
+
return (
|
|
15
|
+
<b>
|
|
16
|
+
<Translate
|
|
17
|
+
id="theme.blog.post.readMore"
|
|
18
|
+
description="The label used in blog post item excerpts to link to full blog posts">
|
|
19
|
+
Read More
|
|
20
|
+
</Translate>
|
|
21
|
+
</b>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default function BlogPostItemFooterReadMoreLink(
|
|
26
|
+
props: Props,
|
|
27
|
+
): JSX.Element {
|
|
28
|
+
const {blogPostTitle, ...linkProps} = props;
|
|
29
|
+
return (
|
|
30
|
+
<Link
|
|
31
|
+
aria-label={translate(
|
|
32
|
+
{
|
|
33
|
+
message: 'Read more about {title}',
|
|
34
|
+
id: 'theme.blog.post.readMoreLabel',
|
|
35
|
+
description:
|
|
36
|
+
'The ARIA label for the link to full blog posts from excerpts',
|
|
37
|
+
},
|
|
38
|
+
{title: blogPostTitle},
|
|
39
|
+
)}
|
|
40
|
+
{...linkProps}>
|
|
41
|
+
<ReadMoreLabel />
|
|
42
|
+
</Link>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
11
|
+
import EditThisPage from '@theme/EditThisPage';
|
|
12
|
+
import TagsListInline from '@theme/TagsListInline';
|
|
13
|
+
import ReadMoreLink from '@theme/BlogPostItem/Footer/ReadMoreLink';
|
|
14
|
+
|
|
15
|
+
import styles from './styles.module.css';
|
|
16
|
+
|
|
17
|
+
export default function BlogPostItemFooter(): JSX.Element | null {
|
|
18
|
+
const {metadata, isBlogPostPage} = useBlogPost();
|
|
19
|
+
const {tags, title, editUrl, hasTruncateMarker} = metadata;
|
|
20
|
+
|
|
21
|
+
// A post is truncated if it's in the "list view" and it has a truncate marker
|
|
22
|
+
const truncatedPost = !isBlogPostPage && hasTruncateMarker;
|
|
23
|
+
|
|
24
|
+
const tagsExists = tags.length > 0;
|
|
25
|
+
|
|
26
|
+
const renderFooter = tagsExists || truncatedPost || editUrl;
|
|
27
|
+
|
|
28
|
+
if (!renderFooter) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<footer
|
|
34
|
+
className={clsx(
|
|
35
|
+
'row docusaurus-mt-lg',
|
|
36
|
+
isBlogPostPage && styles.blogPostFooterDetailsFull,
|
|
37
|
+
)}>
|
|
38
|
+
{tagsExists && (
|
|
39
|
+
<div className={clsx('col', {'col--9': truncatedPost})}>
|
|
40
|
+
<TagsListInline tags={tags} />
|
|
41
|
+
</div>
|
|
42
|
+
)}
|
|
43
|
+
|
|
44
|
+
{isBlogPostPage && editUrl && (
|
|
45
|
+
<div className="col margin-top--sm">
|
|
46
|
+
<EditThisPage editUrl={editUrl} />
|
|
47
|
+
</div>
|
|
48
|
+
)}
|
|
49
|
+
|
|
50
|
+
{truncatedPost && (
|
|
51
|
+
<div
|
|
52
|
+
className={clsx('col text--right', {
|
|
53
|
+
'col--3': tagsExists,
|
|
54
|
+
})}>
|
|
55
|
+
<ReadMoreLink blogPostTitle={title} to={metadata.permalink} />
|
|
56
|
+
</div>
|
|
57
|
+
)}
|
|
58
|
+
</footer>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
@@ -6,8 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
9
10
|
import Link, {type Props as LinkProps} from '@docusaurus/Link';
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
import type {Props} from '@theme/BlogPostItem/Header/Author';
|
|
11
13
|
|
|
12
14
|
function MaybeLink(props: LinkProps): JSX.Element {
|
|
13
15
|
if (props.href) {
|
|
@@ -16,11 +18,14 @@ function MaybeLink(props: LinkProps): JSX.Element {
|
|
|
16
18
|
return <>{props.children}</>;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
|
-
export default function
|
|
21
|
+
export default function BlogPostItemHeaderAuthor({
|
|
22
|
+
author,
|
|
23
|
+
className,
|
|
24
|
+
}: Props): JSX.Element {
|
|
20
25
|
const {name, title, url, imageURL, email} = author;
|
|
21
26
|
const link = url || (email && `mailto:${email}`) || undefined;
|
|
22
27
|
return (
|
|
23
|
-
<div className=
|
|
28
|
+
<div className={clsx('avatar margin-bottom--sm', className)}>
|
|
24
29
|
{imageURL && (
|
|
25
30
|
<MaybeLink href={link} className="avatar__photo-link">
|
|
26
31
|
<img className="avatar__photo" src={imageURL} alt={name} />
|
package/{lib/theme/BlogPostAuthors/index.js → src/theme/BlogPostItem/Header/Authors/index.tsx}
RENAMED
|
@@ -4,12 +4,22 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
+
|
|
7
8
|
import React from 'react';
|
|
8
9
|
import clsx from 'clsx';
|
|
9
|
-
import
|
|
10
|
+
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
11
|
+
import BlogPostItemHeaderAuthor from '@theme/BlogPostItem/Header/Author';
|
|
12
|
+
import type {Props} from '@theme/BlogPostItem/Header/Authors';
|
|
10
13
|
import styles from './styles.module.css';
|
|
14
|
+
|
|
11
15
|
// Component responsible for the authors layout
|
|
12
|
-
export default function
|
|
16
|
+
export default function BlogPostItemHeaderAuthors({
|
|
17
|
+
className,
|
|
18
|
+
}: Props): JSX.Element | null {
|
|
19
|
+
const {
|
|
20
|
+
metadata: {authors},
|
|
21
|
+
assets,
|
|
22
|
+
} = useBlogPost();
|
|
13
23
|
const authorsCount = authors.length;
|
|
14
24
|
if (authorsCount === 0) {
|
|
15
25
|
return null;
|
|
@@ -20,6 +30,7 @@ export default function BlogPostAuthors({authors, assets}) {
|
|
|
20
30
|
className={clsx(
|
|
21
31
|
'margin-top--md margin-bottom--sm',
|
|
22
32
|
imageOnly ? styles.imageOnlyAuthorRow : 'row',
|
|
33
|
+
className,
|
|
23
34
|
)}>
|
|
24
35
|
{authors.map((author, idx) => (
|
|
25
36
|
<div
|
|
@@ -28,7 +39,7 @@ export default function BlogPostAuthors({authors, assets}) {
|
|
|
28
39
|
imageOnly ? styles.imageOnlyAuthorCol : styles.authorCol,
|
|
29
40
|
)}
|
|
30
41
|
key={idx}>
|
|
31
|
-
<
|
|
42
|
+
<BlogPostItemHeaderAuthor
|
|
32
43
|
author={{
|
|
33
44
|
...author,
|
|
34
45
|
// Handle author images using relative paths
|
|
File without changes
|