@docusaurus/theme-classic 0.0.0-5834 → 0.0.0-5835
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/BlogLayout/index.js +1 -3
- package/lib/theme/BlogListPage/StructuredData/index.d.ts +10 -0
- package/lib/theme/BlogListPage/StructuredData/index.js +19 -0
- package/lib/theme/BlogListPage/index.js +2 -0
- package/lib/theme/BlogPostItem/Container/index.js +1 -26
- package/lib/theme/BlogPostItem/Content/index.js +1 -2
- package/lib/theme/BlogPostItem/Header/Author/index.js +5 -18
- package/lib/theme/BlogPostItem/Header/Info/index.js +1 -5
- package/lib/theme/BlogPostItem/Header/Title/index.js +2 -8
- package/lib/theme/BlogPostPage/StructuredData/index.d.ts +8 -0
- package/lib/theme/BlogPostPage/StructuredData/index.js +19 -0
- package/lib/theme/BlogPostPage/index.js +3 -0
- package/package.json +14 -14
- package/src/theme/BlogLayout/index.tsx +1 -3
- package/src/theme/BlogListPage/StructuredData/index.tsx +22 -0
- package/src/theme/BlogListPage/index.tsx +2 -0
- package/src/theme/BlogPostItem/Container/index.tsx +1 -26
- package/src/theme/BlogPostItem/Content/index.tsx +1 -2
- package/src/theme/BlogPostItem/Header/Author/index.tsx +5 -18
- package/src/theme/BlogPostItem/Header/Info/index.tsx +1 -5
- package/src/theme/BlogPostItem/Header/Title/index.tsx +2 -8
- package/src/theme/BlogPostPage/StructuredData/index.tsx +21 -0
- package/src/theme/BlogPostPage/index.tsx +3 -0
|
@@ -20,9 +20,7 @@ export default function BlogLayout(props) {
|
|
|
20
20
|
className={clsx('col', {
|
|
21
21
|
'col--7': hasSidebar,
|
|
22
22
|
'col--9 col--offset-1': !hasSidebar,
|
|
23
|
-
})}
|
|
24
|
-
itemScope
|
|
25
|
-
itemType="https://schema.org/Blog">
|
|
23
|
+
})}>
|
|
26
24
|
{children}
|
|
27
25
|
</main>
|
|
28
26
|
{toc && <div className="col col--2">{toc}</div>}
|
|
@@ -0,0 +1,10 @@
|
|
|
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="@docusaurus/plugin-content-blog" />
|
|
8
|
+
/// <reference types="react" />
|
|
9
|
+
import type { Props } from '@theme/BlogListPage/StructuredData';
|
|
10
|
+
export default function BlogListPageStructuredData(props: Props): JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
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 Head from '@docusaurus/Head';
|
|
9
|
+
import {useBlogListPageStructuredData} from '@docusaurus/theme-common';
|
|
10
|
+
export default function BlogListPageStructuredData(props) {
|
|
11
|
+
const structuredData = useBlogListPageStructuredData(props);
|
|
12
|
+
return (
|
|
13
|
+
<Head>
|
|
14
|
+
<script type="application/ld+json">
|
|
15
|
+
{JSON.stringify(structuredData)}
|
|
16
|
+
</script>
|
|
17
|
+
</Head>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -16,6 +16,7 @@ import BlogLayout from '@theme/BlogLayout';
|
|
|
16
16
|
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
17
17
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
18
18
|
import BlogPostItems from '@theme/BlogPostItems';
|
|
19
|
+
import BlogListPageStructuredData from '@theme/BlogListPage/StructuredData';
|
|
19
20
|
function BlogListPageMetadata(props) {
|
|
20
21
|
const {metadata} = props;
|
|
21
22
|
const {
|
|
@@ -48,6 +49,7 @@ export default function BlogListPage(props) {
|
|
|
48
49
|
ThemeClassNames.page.blogListPage,
|
|
49
50
|
)}>
|
|
50
51
|
<BlogListPageMetadata {...props} />
|
|
52
|
+
<BlogListPageStructuredData {...props} />
|
|
51
53
|
<BlogListPageContent {...props} />
|
|
52
54
|
</HtmlClassNameProvider>
|
|
53
55
|
);
|
|
@@ -5,31 +5,6 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
|
|
9
|
-
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
10
8
|
export default function BlogPostItemContainer({children, className}) {
|
|
11
|
-
|
|
12
|
-
frontMatter,
|
|
13
|
-
assets,
|
|
14
|
-
metadata: {description},
|
|
15
|
-
} = useBlogPost();
|
|
16
|
-
const {withBaseUrl} = useBaseUrlUtils();
|
|
17
|
-
const image = assets.image ?? frontMatter.image;
|
|
18
|
-
const keywords = frontMatter.keywords ?? [];
|
|
19
|
-
return (
|
|
20
|
-
<article
|
|
21
|
-
className={className}
|
|
22
|
-
itemProp="blogPost"
|
|
23
|
-
itemScope
|
|
24
|
-
itemType="https://schema.org/BlogPosting">
|
|
25
|
-
{description && <meta itemProp="description" content={description} />}
|
|
26
|
-
{image && (
|
|
27
|
-
<link itemProp="image" href={withBaseUrl(image, {absolute: true})} />
|
|
28
|
-
)}
|
|
29
|
-
{keywords.length > 0 && (
|
|
30
|
-
<meta itemProp="keywords" content={keywords.join(',')} />
|
|
31
|
-
)}
|
|
32
|
-
{children}
|
|
33
|
-
</article>
|
|
34
|
-
);
|
|
9
|
+
return <article className={className}>{children}</article>;
|
|
35
10
|
}
|
|
@@ -15,8 +15,7 @@ export default function BlogPostItemContent({children, className}) {
|
|
|
15
15
|
<div
|
|
16
16
|
// This ID is used for the feed generation to locate the main content
|
|
17
17
|
id={isBlogPostPage ? blogPostContainerID : undefined}
|
|
18
|
-
className={clsx('markdown', className)}
|
|
19
|
-
itemProp="articleBody">
|
|
18
|
+
className={clsx('markdown', className)}>
|
|
20
19
|
<MDXContent>{children}</MDXContent>
|
|
21
20
|
</div>
|
|
22
21
|
);
|
|
@@ -20,31 +20,18 @@ export default function BlogPostItemHeaderAuthor({author, className}) {
|
|
|
20
20
|
<div className={clsx('avatar margin-bottom--sm', className)}>
|
|
21
21
|
{imageURL && (
|
|
22
22
|
<MaybeLink href={link} className="avatar__photo-link">
|
|
23
|
-
<img
|
|
24
|
-
className="avatar__photo"
|
|
25
|
-
src={imageURL}
|
|
26
|
-
alt={name}
|
|
27
|
-
itemProp="image"
|
|
28
|
-
/>
|
|
23
|
+
<img className="avatar__photo" src={imageURL} alt={name} />
|
|
29
24
|
</MaybeLink>
|
|
30
25
|
)}
|
|
31
26
|
|
|
32
27
|
{name && (
|
|
33
|
-
<div
|
|
34
|
-
className="avatar__intro"
|
|
35
|
-
itemProp="author"
|
|
36
|
-
itemScope
|
|
37
|
-
itemType="https://schema.org/Person">
|
|
28
|
+
<div className="avatar__intro">
|
|
38
29
|
<div className="avatar__name">
|
|
39
|
-
<MaybeLink href={link}
|
|
40
|
-
<span
|
|
30
|
+
<MaybeLink href={link}>
|
|
31
|
+
<span>{name}</span>
|
|
41
32
|
</MaybeLink>
|
|
42
33
|
</div>
|
|
43
|
-
{title &&
|
|
44
|
-
<small className="avatar__subtitle" itemProp="description">
|
|
45
|
-
{title}
|
|
46
|
-
</small>
|
|
47
|
-
)}
|
|
34
|
+
{title && <small className="avatar__subtitle">{title}</small>}
|
|
48
35
|
</div>
|
|
49
36
|
)}
|
|
50
37
|
</div>
|
|
@@ -34,11 +34,7 @@ function ReadingTime({readingTime}) {
|
|
|
34
34
|
return <>{readingTimePlural(readingTime)}</>;
|
|
35
35
|
}
|
|
36
36
|
function Date({date, formattedDate}) {
|
|
37
|
-
return
|
|
38
|
-
<time dateTime={date} itemProp="datePublished">
|
|
39
|
-
{formattedDate}
|
|
40
|
-
</time>
|
|
41
|
-
);
|
|
37
|
+
return <time dateTime={date}>{formattedDate}</time>;
|
|
42
38
|
}
|
|
43
39
|
function Spacer() {
|
|
44
40
|
return <>{' · '}</>;
|
|
@@ -14,14 +14,8 @@ export default function BlogPostItemHeaderTitle({className}) {
|
|
|
14
14
|
const {permalink, title} = metadata;
|
|
15
15
|
const TitleHeading = isBlogPostPage ? 'h1' : 'h2';
|
|
16
16
|
return (
|
|
17
|
-
<TitleHeading className={clsx(styles.title, className)}
|
|
18
|
-
{isBlogPostPage ?
|
|
19
|
-
title
|
|
20
|
-
) : (
|
|
21
|
-
<Link itemProp="url" to={permalink}>
|
|
22
|
-
{title}
|
|
23
|
-
</Link>
|
|
24
|
-
)}
|
|
17
|
+
<TitleHeading className={clsx(styles.title, className)}>
|
|
18
|
+
{isBlogPostPage ? title : <Link to={permalink}>{title}</Link>}
|
|
25
19
|
</TitleHeading>
|
|
26
20
|
);
|
|
27
21
|
}
|
|
@@ -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 BlogPostStructuredData(): JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
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 Head from '@docusaurus/Head';
|
|
9
|
+
import {useBlogPostStructuredData} from '@docusaurus/theme-common';
|
|
10
|
+
export default function BlogPostStructuredData() {
|
|
11
|
+
const structuredData = useBlogPostStructuredData();
|
|
12
|
+
return (
|
|
13
|
+
<Head>
|
|
14
|
+
<script type="application/ld+json">
|
|
15
|
+
{JSON.stringify(structuredData)}
|
|
16
|
+
</script>
|
|
17
|
+
</Head>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -12,6 +12,7 @@ import BlogLayout from '@theme/BlogLayout';
|
|
|
12
12
|
import BlogPostItem from '@theme/BlogPostItem';
|
|
13
13
|
import BlogPostPaginator from '@theme/BlogPostPaginator';
|
|
14
14
|
import BlogPostPageMetadata from '@theme/BlogPostPage/Metadata';
|
|
15
|
+
import BlogPostPageStructuredData from '@theme/BlogPostPage/StructuredData';
|
|
15
16
|
import TOC from '@theme/TOC';
|
|
16
17
|
import Unlisted from '@theme/Unlisted';
|
|
17
18
|
function BlogPostPageContent({sidebar, children}) {
|
|
@@ -35,6 +36,7 @@ function BlogPostPageContent({sidebar, children}) {
|
|
|
35
36
|
) : undefined
|
|
36
37
|
}>
|
|
37
38
|
{unlisted && <Unlisted />}
|
|
39
|
+
|
|
38
40
|
<BlogPostItem>{children}</BlogPostItem>
|
|
39
41
|
|
|
40
42
|
{(nextItem || prevItem) && (
|
|
@@ -53,6 +55,7 @@ export default function BlogPostPage(props) {
|
|
|
53
55
|
ThemeClassNames.page.blogPostPage,
|
|
54
56
|
)}>
|
|
55
57
|
<BlogPostPageMetadata />
|
|
58
|
+
<BlogPostPageStructuredData />
|
|
56
59
|
<BlogPostPageContent sidebar={props.sidebar}>
|
|
57
60
|
<BlogPostContent />
|
|
58
61
|
</BlogPostPageContent>
|
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-5835",
|
|
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-5835",
|
|
24
|
+
"@docusaurus/mdx-loader": "0.0.0-5835",
|
|
25
|
+
"@docusaurus/module-type-aliases": "0.0.0-5835",
|
|
26
|
+
"@docusaurus/plugin-content-blog": "0.0.0-5835",
|
|
27
|
+
"@docusaurus/plugin-content-docs": "0.0.0-5835",
|
|
28
|
+
"@docusaurus/plugin-content-pages": "0.0.0-5835",
|
|
29
|
+
"@docusaurus/theme-common": "0.0.0-5835",
|
|
30
|
+
"@docusaurus/theme-translations": "0.0.0-5835",
|
|
31
|
+
"@docusaurus/types": "0.0.0-5835",
|
|
32
|
+
"@docusaurus/utils": "0.0.0-5835",
|
|
33
|
+
"@docusaurus/utils-common": "0.0.0-5835",
|
|
34
|
+
"@docusaurus/utils-validation": "0.0.0-5835",
|
|
35
35
|
"@mdx-js/react": "^3.0.0",
|
|
36
36
|
"clsx": "^2.0.0",
|
|
37
37
|
"copy-text-to-clipboard": "^3.2.0",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=18.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "63065664a850451b45d9b9fcaaf110388d1e39d4"
|
|
65
65
|
}
|
|
@@ -25,9 +25,7 @@ export default function BlogLayout(props: Props): JSX.Element {
|
|
|
25
25
|
className={clsx('col', {
|
|
26
26
|
'col--7': hasSidebar,
|
|
27
27
|
'col--9 col--offset-1': !hasSidebar,
|
|
28
|
-
})}
|
|
29
|
-
itemScope
|
|
30
|
-
itemType="https://schema.org/Blog">
|
|
28
|
+
})}>
|
|
31
29
|
{children}
|
|
32
30
|
</main>
|
|
33
31
|
{toc && <div className="col col--2">{toc}</div>}
|
|
@@ -0,0 +1,22 @@
|
|
|
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 Head from '@docusaurus/Head';
|
|
10
|
+
import {useBlogListPageStructuredData} from '@docusaurus/theme-common';
|
|
11
|
+
import type {Props} from '@theme/BlogListPage/StructuredData';
|
|
12
|
+
|
|
13
|
+
export default function BlogListPageStructuredData(props: Props): JSX.Element {
|
|
14
|
+
const structuredData = useBlogListPageStructuredData(props);
|
|
15
|
+
return (
|
|
16
|
+
<Head>
|
|
17
|
+
<script type="application/ld+json">
|
|
18
|
+
{JSON.stringify(structuredData)}
|
|
19
|
+
</script>
|
|
20
|
+
</Head>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -19,6 +19,7 @@ import BlogListPaginator from '@theme/BlogListPaginator';
|
|
|
19
19
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
20
20
|
import type {Props} from '@theme/BlogListPage';
|
|
21
21
|
import BlogPostItems from '@theme/BlogPostItems';
|
|
22
|
+
import BlogListPageStructuredData from '@theme/BlogListPage/StructuredData';
|
|
22
23
|
|
|
23
24
|
function BlogListPageMetadata(props: Props): JSX.Element {
|
|
24
25
|
const {metadata} = props;
|
|
@@ -54,6 +55,7 @@ export default function BlogListPage(props: Props): JSX.Element {
|
|
|
54
55
|
ThemeClassNames.page.blogListPage,
|
|
55
56
|
)}>
|
|
56
57
|
<BlogListPageMetadata {...props} />
|
|
58
|
+
<BlogListPageStructuredData {...props} />
|
|
57
59
|
<BlogListPageContent {...props} />
|
|
58
60
|
</HtmlClassNameProvider>
|
|
59
61
|
);
|
|
@@ -6,36 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
|
|
10
|
-
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
11
9
|
import type {Props} from '@theme/BlogPostItem/Container';
|
|
12
10
|
|
|
13
11
|
export default function BlogPostItemContainer({
|
|
14
12
|
children,
|
|
15
13
|
className,
|
|
16
14
|
}: Props): JSX.Element {
|
|
17
|
-
|
|
18
|
-
frontMatter,
|
|
19
|
-
assets,
|
|
20
|
-
metadata: {description},
|
|
21
|
-
} = useBlogPost();
|
|
22
|
-
const {withBaseUrl} = useBaseUrlUtils();
|
|
23
|
-
const image = assets.image ?? frontMatter.image;
|
|
24
|
-
const keywords = frontMatter.keywords ?? [];
|
|
25
|
-
return (
|
|
26
|
-
<article
|
|
27
|
-
className={className}
|
|
28
|
-
itemProp="blogPost"
|
|
29
|
-
itemScope
|
|
30
|
-
itemType="https://schema.org/BlogPosting">
|
|
31
|
-
{description && <meta itemProp="description" content={description} />}
|
|
32
|
-
{image && (
|
|
33
|
-
<link itemProp="image" href={withBaseUrl(image, {absolute: true})} />
|
|
34
|
-
)}
|
|
35
|
-
{keywords.length > 0 && (
|
|
36
|
-
<meta itemProp="keywords" content={keywords.join(',')} />
|
|
37
|
-
)}
|
|
38
|
-
{children}
|
|
39
|
-
</article>
|
|
40
|
-
);
|
|
15
|
+
return <article className={className}>{children}</article>;
|
|
41
16
|
}
|
|
@@ -21,8 +21,7 @@ export default function BlogPostItemContent({
|
|
|
21
21
|
<div
|
|
22
22
|
// This ID is used for the feed generation to locate the main content
|
|
23
23
|
id={isBlogPostPage ? blogPostContainerID : undefined}
|
|
24
|
-
className={clsx('markdown', className)}
|
|
25
|
-
itemProp="articleBody">
|
|
24
|
+
className={clsx('markdown', className)}>
|
|
26
25
|
<MDXContent>{children}</MDXContent>
|
|
27
26
|
</div>
|
|
28
27
|
);
|
|
@@ -28,31 +28,18 @@ export default function BlogPostItemHeaderAuthor({
|
|
|
28
28
|
<div className={clsx('avatar margin-bottom--sm', className)}>
|
|
29
29
|
{imageURL && (
|
|
30
30
|
<MaybeLink href={link} className="avatar__photo-link">
|
|
31
|
-
<img
|
|
32
|
-
className="avatar__photo"
|
|
33
|
-
src={imageURL}
|
|
34
|
-
alt={name}
|
|
35
|
-
itemProp="image"
|
|
36
|
-
/>
|
|
31
|
+
<img className="avatar__photo" src={imageURL} alt={name} />
|
|
37
32
|
</MaybeLink>
|
|
38
33
|
)}
|
|
39
34
|
|
|
40
35
|
{name && (
|
|
41
|
-
<div
|
|
42
|
-
className="avatar__intro"
|
|
43
|
-
itemProp="author"
|
|
44
|
-
itemScope
|
|
45
|
-
itemType="https://schema.org/Person">
|
|
36
|
+
<div className="avatar__intro">
|
|
46
37
|
<div className="avatar__name">
|
|
47
|
-
<MaybeLink href={link}
|
|
48
|
-
<span
|
|
38
|
+
<MaybeLink href={link}>
|
|
39
|
+
<span>{name}</span>
|
|
49
40
|
</MaybeLink>
|
|
50
41
|
</div>
|
|
51
|
-
{title &&
|
|
52
|
-
<small className="avatar__subtitle" itemProp="description">
|
|
53
|
-
{title}
|
|
54
|
-
</small>
|
|
55
|
-
)}
|
|
42
|
+
{title && <small className="avatar__subtitle">{title}</small>}
|
|
56
43
|
</div>
|
|
57
44
|
)}
|
|
58
45
|
</div>
|
|
@@ -40,11 +40,7 @@ function ReadingTime({readingTime}: {readingTime: number}) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
function Date({date, formattedDate}: {date: string; formattedDate: string}) {
|
|
43
|
-
return
|
|
44
|
-
<time dateTime={date} itemProp="datePublished">
|
|
45
|
-
{formattedDate}
|
|
46
|
-
</time>
|
|
47
|
-
);
|
|
43
|
+
return <time dateTime={date}>{formattedDate}</time>;
|
|
48
44
|
}
|
|
49
45
|
|
|
50
46
|
function Spacer() {
|
|
@@ -20,14 +20,8 @@ export default function BlogPostItemHeaderTitle({
|
|
|
20
20
|
const {permalink, title} = metadata;
|
|
21
21
|
const TitleHeading = isBlogPostPage ? 'h1' : 'h2';
|
|
22
22
|
return (
|
|
23
|
-
<TitleHeading className={clsx(styles.title, className)}
|
|
24
|
-
{isBlogPostPage ?
|
|
25
|
-
title
|
|
26
|
-
) : (
|
|
27
|
-
<Link itemProp="url" to={permalink}>
|
|
28
|
-
{title}
|
|
29
|
-
</Link>
|
|
30
|
-
)}
|
|
23
|
+
<TitleHeading className={clsx(styles.title, className)}>
|
|
24
|
+
{isBlogPostPage ? title : <Link to={permalink}>{title}</Link>}
|
|
31
25
|
</TitleHeading>
|
|
32
26
|
);
|
|
33
27
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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 Head from '@docusaurus/Head';
|
|
10
|
+
import {useBlogPostStructuredData} from '@docusaurus/theme-common';
|
|
11
|
+
|
|
12
|
+
export default function BlogPostStructuredData(): JSX.Element {
|
|
13
|
+
const structuredData = useBlogPostStructuredData();
|
|
14
|
+
return (
|
|
15
|
+
<Head>
|
|
16
|
+
<script type="application/ld+json">
|
|
17
|
+
{JSON.stringify(structuredData)}
|
|
18
|
+
</script>
|
|
19
|
+
</Head>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -13,6 +13,7 @@ import BlogLayout from '@theme/BlogLayout';
|
|
|
13
13
|
import BlogPostItem from '@theme/BlogPostItem';
|
|
14
14
|
import BlogPostPaginator from '@theme/BlogPostPaginator';
|
|
15
15
|
import BlogPostPageMetadata from '@theme/BlogPostPage/Metadata';
|
|
16
|
+
import BlogPostPageStructuredData from '@theme/BlogPostPage/StructuredData';
|
|
16
17
|
import TOC from '@theme/TOC';
|
|
17
18
|
import type {Props} from '@theme/BlogPostPage';
|
|
18
19
|
import Unlisted from '@theme/Unlisted';
|
|
@@ -45,6 +46,7 @@ function BlogPostPageContent({
|
|
|
45
46
|
) : undefined
|
|
46
47
|
}>
|
|
47
48
|
{unlisted && <Unlisted />}
|
|
49
|
+
|
|
48
50
|
<BlogPostItem>{children}</BlogPostItem>
|
|
49
51
|
|
|
50
52
|
{(nextItem || prevItem) && (
|
|
@@ -64,6 +66,7 @@ export default function BlogPostPage(props: Props): JSX.Element {
|
|
|
64
66
|
ThemeClassNames.page.blogPostPage,
|
|
65
67
|
)}>
|
|
66
68
|
<BlogPostPageMetadata />
|
|
69
|
+
<BlogPostPageStructuredData />
|
|
67
70
|
<BlogPostPageContent sidebar={props.sidebar}>
|
|
68
71
|
<BlogPostContent />
|
|
69
72
|
</BlogPostPageContent>
|