@docusaurus/theme-classic 0.0.0-4736 → 0.0.0-4739
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-classic.d.ts +5 -33
- package/lib-next/theme/BlogArchivePage/index.js +13 -9
- package/lib-next/theme/BlogListPage/index.js +34 -13
- package/lib-next/theme/BlogPostPage/index.js +56 -45
- package/lib-next/theme/BlogTagsListPage/index.js +16 -12
- package/lib-next/theme/BlogTagsPostsPage/index.js +40 -33
- package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +27 -6
- package/lib-next/theme/DocItem/index.js +78 -63
- package/lib-next/theme/DocPage/index.js +85 -77
- package/lib-next/theme/DocPage/styles.module.css +0 -4
- package/lib-next/theme/DocTagDocListPage/index.js +38 -31
- package/lib-next/theme/DocTagsListPage/index.js +21 -16
- package/lib-next/theme/Layout/index.js +15 -10
- package/lib-next/theme/MDXPage/index.js +32 -26
- package/lib-next/theme/NotFound.js +38 -33
- package/lib-next/theme/{LayoutHead → SiteMetadata}/index.js +11 -26
- package/package.json +13 -13
- package/src/theme/BlogArchivePage/index.tsx +13 -9
- package/src/theme/BlogListPage/index.tsx +32 -13
- package/src/theme/BlogPostPage/index.tsx +55 -48
- package/src/theme/BlogTagsListPage/index.tsx +16 -12
- package/src/theme/BlogTagsPostsPage/index.tsx +39 -32
- package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +31 -4
- package/src/theme/DocItem/index.tsx +65 -52
- package/src/theme/DocPage/index.tsx +85 -77
- package/src/theme/DocPage/styles.module.css +0 -4
- package/src/theme/DocTagDocListPage/index.tsx +38 -30
- package/src/theme/DocTagsListPage/index.tsx +21 -16
- package/src/theme/Layout/index.tsx +15 -10
- package/src/theme/MDXPage/index.tsx +32 -26
- package/src/theme/NotFound.tsx +38 -33
- package/src/theme/{LayoutHead → SiteMetadata}/index.tsx +11 -25
- package/src/theme-classic.d.ts +5 -33
- package/lib-next/theme/Seo/index.js +0 -40
- package/src/theme/Seo/index.tsx +0 -49
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-4739",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"format:lib-next": "prettier --config ../../.prettierrc --write \"lib-next/**/*.{js,ts,jsx,tsc}\""
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@docusaurus/core": "0.0.0-
|
|
25
|
-
"@docusaurus/plugin-content-blog": "0.0.0-
|
|
26
|
-
"@docusaurus/plugin-content-docs": "0.0.0-
|
|
27
|
-
"@docusaurus/plugin-content-pages": "0.0.0-
|
|
28
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
29
|
-
"@docusaurus/theme-translations": "0.0.0-
|
|
30
|
-
"@docusaurus/utils": "0.0.0-
|
|
31
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
32
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
24
|
+
"@docusaurus/core": "0.0.0-4739",
|
|
25
|
+
"@docusaurus/plugin-content-blog": "0.0.0-4739",
|
|
26
|
+
"@docusaurus/plugin-content-docs": "0.0.0-4739",
|
|
27
|
+
"@docusaurus/plugin-content-pages": "0.0.0-4739",
|
|
28
|
+
"@docusaurus/theme-common": "0.0.0-4739",
|
|
29
|
+
"@docusaurus/theme-translations": "0.0.0-4739",
|
|
30
|
+
"@docusaurus/utils": "0.0.0-4739",
|
|
31
|
+
"@docusaurus/utils-common": "0.0.0-4739",
|
|
32
|
+
"@docusaurus/utils-validation": "0.0.0-4739",
|
|
33
33
|
"@mdx-js/react": "^1.6.22",
|
|
34
34
|
"clsx": "^1.1.1",
|
|
35
35
|
"copy-text-to-clipboard": "^3.0.1",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"rtlcss": "^3.5.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
46
|
-
"@docusaurus/types": "0.0.0-
|
|
45
|
+
"@docusaurus/module-type-aliases": "0.0.0-4739",
|
|
46
|
+
"@docusaurus/types": "0.0.0-4739",
|
|
47
47
|
"@types/mdx-js__react": "^1.5.5",
|
|
48
48
|
"@types/prismjs": "^1.26.0",
|
|
49
49
|
"@types/rtlcss": "^3.1.2",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=14"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "5902cd7b653725a71940b98169190908d22cffe9"
|
|
63
63
|
}
|
|
@@ -10,6 +10,7 @@ import Layout from '@theme/Layout';
|
|
|
10
10
|
import Link from '@docusaurus/Link';
|
|
11
11
|
import type {ArchiveBlogPost, Props} from '@theme/BlogArchivePage';
|
|
12
12
|
import {translate} from '@docusaurus/Translate';
|
|
13
|
+
import {PageMetadata} from '@docusaurus/theme-common';
|
|
13
14
|
|
|
14
15
|
type YearProp = {
|
|
15
16
|
year: string;
|
|
@@ -75,14 +76,17 @@ export default function BlogArchive({archive}: Props): JSX.Element {
|
|
|
75
76
|
});
|
|
76
77
|
const years = listPostsByYears(archive.blogPosts);
|
|
77
78
|
return (
|
|
78
|
-
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
<>
|
|
80
|
+
<PageMetadata title={title} description={description} />
|
|
81
|
+
<Layout>
|
|
82
|
+
<header className="hero hero--primary">
|
|
83
|
+
<div className="container">
|
|
84
|
+
<h1 className="hero__title">{title}</h1>
|
|
85
|
+
<p className="hero__subtitle">{description}</p>
|
|
86
|
+
</div>
|
|
87
|
+
</header>
|
|
88
|
+
<main>{years.length > 0 && <YearsSection years={years} />}</main>
|
|
89
|
+
</Layout>
|
|
90
|
+
</>
|
|
87
91
|
);
|
|
88
92
|
}
|
|
@@ -12,28 +12,34 @@ import BlogLayout from '@theme/BlogLayout';
|
|
|
12
12
|
import BlogPostItem from '@theme/BlogPostItem';
|
|
13
13
|
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
14
14
|
import type {Props} from '@theme/BlogListPage';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
PageMetadata,
|
|
17
|
+
HtmlClassNameProvider,
|
|
18
|
+
ThemeClassNames,
|
|
19
|
+
} from '@docusaurus/theme-common';
|
|
20
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
21
|
+
import clsx from 'clsx';
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
const {metadata
|
|
23
|
+
function BlogListPageMetadata(props: Props): JSX.Element {
|
|
24
|
+
const {metadata} = props;
|
|
19
25
|
const {
|
|
20
26
|
siteConfig: {title: siteTitle},
|
|
21
27
|
} = useDocusaurusContext();
|
|
22
28
|
const {blogDescription, blogTitle, permalink} = metadata;
|
|
23
29
|
const isBlogOnlyMode = permalink === '/';
|
|
24
30
|
const title = isBlogOnlyMode ? siteTitle : blogTitle;
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<PageMetadata title={title} description={blogDescription} />
|
|
34
|
+
<SearchMetadata tag="blog_posts_list" />
|
|
35
|
+
</>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
25
38
|
|
|
39
|
+
function BlogListPageContent(props: Props): JSX.Element {
|
|
40
|
+
const {metadata, items, sidebar} = props;
|
|
26
41
|
return (
|
|
27
|
-
<BlogLayout
|
|
28
|
-
title={title}
|
|
29
|
-
description={blogDescription}
|
|
30
|
-
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
|
31
|
-
pageClassName={ThemeClassNames.page.blogListPage}
|
|
32
|
-
searchMetadata={{
|
|
33
|
-
// assign unique search tag to exclude this page from search results!
|
|
34
|
-
tag: 'blog_posts_list',
|
|
35
|
-
}}
|
|
36
|
-
sidebar={sidebar}>
|
|
42
|
+
<BlogLayout sidebar={sidebar}>
|
|
37
43
|
{items.map(({content: BlogPostContent}) => (
|
|
38
44
|
<BlogPostItem
|
|
39
45
|
key={BlogPostContent.metadata.permalink}
|
|
@@ -48,3 +54,16 @@ export default function BlogListPage(props: Props): JSX.Element {
|
|
|
48
54
|
</BlogLayout>
|
|
49
55
|
);
|
|
50
56
|
}
|
|
57
|
+
|
|
58
|
+
export default function BlogListPage(props: Props): JSX.Element {
|
|
59
|
+
return (
|
|
60
|
+
<HtmlClassNameProvider
|
|
61
|
+
className={clsx(
|
|
62
|
+
ThemeClassNames.wrapper.blogPages,
|
|
63
|
+
ThemeClassNames.page.blogListPage,
|
|
64
|
+
)}>
|
|
65
|
+
<BlogListPageMetadata {...props} />
|
|
66
|
+
<BlogListPageContent {...props} />
|
|
67
|
+
</HtmlClassNameProvider>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -6,40 +6,63 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import Seo from '@theme/Seo';
|
|
10
9
|
import BlogLayout from '@theme/BlogLayout';
|
|
11
10
|
import BlogPostItem from '@theme/BlogPostItem';
|
|
12
11
|
import BlogPostPaginator from '@theme/BlogPostPaginator';
|
|
13
12
|
import type {Props} from '@theme/BlogPostPage';
|
|
14
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
PageMetadata,
|
|
15
|
+
HtmlClassNameProvider,
|
|
16
|
+
ThemeClassNames,
|
|
17
|
+
} from '@docusaurus/theme-common';
|
|
15
18
|
import TOC from '@theme/TOC';
|
|
19
|
+
import clsx from 'clsx';
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
function BlogPostPageMetadata(props: Props): JSX.Element {
|
|
22
|
+
const {content: BlogPostContents} = props;
|
|
23
|
+
const {assets, metadata} = BlogPostContents;
|
|
24
|
+
const {title, description, date, tags, authors, frontMatter} = metadata;
|
|
25
|
+
const {keywords} = frontMatter;
|
|
26
|
+
const image = assets.image ?? frontMatter.image;
|
|
27
|
+
return (
|
|
28
|
+
<PageMetadata
|
|
29
|
+
title={title}
|
|
30
|
+
description={description}
|
|
31
|
+
keywords={keywords}
|
|
32
|
+
image={image}>
|
|
33
|
+
<meta property="og:type" content="article" />
|
|
34
|
+
<meta property="article:published_time" content={date} />
|
|
35
|
+
{/* TODO double check those article meta array syntaxes, see https://ogp.me/#array */}
|
|
36
|
+
{authors.some((author) => author.url) && (
|
|
37
|
+
<meta
|
|
38
|
+
property="article:author"
|
|
39
|
+
content={authors
|
|
40
|
+
.map((author) => author.url)
|
|
41
|
+
.filter(Boolean)
|
|
42
|
+
.join(',')}
|
|
43
|
+
/>
|
|
44
|
+
)}
|
|
45
|
+
{tags.length > 0 && (
|
|
46
|
+
<meta
|
|
47
|
+
property="article:tag"
|
|
48
|
+
content={tags.map((tag) => tag.label).join(',')}
|
|
49
|
+
/>
|
|
50
|
+
)}
|
|
51
|
+
</PageMetadata>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function BlogPostPageContent(props: Props): JSX.Element {
|
|
18
56
|
const {content: BlogPostContents, sidebar} = props;
|
|
19
57
|
const {assets, metadata} = BlogPostContents;
|
|
20
|
-
const {
|
|
21
|
-
title,
|
|
22
|
-
description,
|
|
23
|
-
nextItem,
|
|
24
|
-
prevItem,
|
|
25
|
-
date,
|
|
26
|
-
tags,
|
|
27
|
-
authors,
|
|
28
|
-
frontMatter,
|
|
29
|
-
} = metadata;
|
|
58
|
+
const {nextItem, prevItem, frontMatter} = metadata;
|
|
30
59
|
const {
|
|
31
60
|
hide_table_of_contents: hideTableOfContents,
|
|
32
|
-
keywords,
|
|
33
61
|
toc_min_heading_level: tocMinHeadingLevel,
|
|
34
62
|
toc_max_heading_level: tocMaxHeadingLevel,
|
|
35
63
|
} = frontMatter;
|
|
36
|
-
|
|
37
|
-
const image = assets.image ?? frontMatter.image;
|
|
38
|
-
|
|
39
64
|
return (
|
|
40
65
|
<BlogLayout
|
|
41
|
-
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
|
42
|
-
pageClassName={ThemeClassNames.page.blogPostPage}
|
|
43
66
|
sidebar={sidebar}
|
|
44
67
|
toc={
|
|
45
68
|
!hideTableOfContents &&
|
|
@@ -52,35 +75,6 @@ export default function BlogPostPage(props: Props): JSX.Element {
|
|
|
52
75
|
/>
|
|
53
76
|
) : undefined
|
|
54
77
|
}>
|
|
55
|
-
<Seo
|
|
56
|
-
// TODO refactor needed: it's a bit annoying but Seo MUST be inside
|
|
57
|
-
// BlogLayout, otherwise default image (set by BlogLayout) would shadow
|
|
58
|
-
// the custom blog post image
|
|
59
|
-
title={title}
|
|
60
|
-
description={description}
|
|
61
|
-
keywords={keywords}
|
|
62
|
-
image={image}>
|
|
63
|
-
<meta property="og:type" content="article" />
|
|
64
|
-
<meta property="article:published_time" content={date} />
|
|
65
|
-
|
|
66
|
-
{/* TODO double check those article meta array syntaxes, see https://ogp.me/#array */}
|
|
67
|
-
{authors.some((author) => author.url) && (
|
|
68
|
-
<meta
|
|
69
|
-
property="article:author"
|
|
70
|
-
content={authors
|
|
71
|
-
.map((author) => author.url)
|
|
72
|
-
.filter(Boolean)
|
|
73
|
-
.join(',')}
|
|
74
|
-
/>
|
|
75
|
-
)}
|
|
76
|
-
{tags.length > 0 && (
|
|
77
|
-
<meta
|
|
78
|
-
property="article:tag"
|
|
79
|
-
content={tags.map((tag) => tag.label).join(',')}
|
|
80
|
-
/>
|
|
81
|
-
)}
|
|
82
|
-
</Seo>
|
|
83
|
-
|
|
84
78
|
<BlogPostItem
|
|
85
79
|
frontMatter={frontMatter}
|
|
86
80
|
assets={assets}
|
|
@@ -95,3 +89,16 @@ export default function BlogPostPage(props: Props): JSX.Element {
|
|
|
95
89
|
</BlogLayout>
|
|
96
90
|
);
|
|
97
91
|
}
|
|
92
|
+
|
|
93
|
+
export default function BlogPostPage(props: Props): JSX.Element {
|
|
94
|
+
return (
|
|
95
|
+
<HtmlClassNameProvider
|
|
96
|
+
className={clsx(
|
|
97
|
+
ThemeClassNames.wrapper.blogPages,
|
|
98
|
+
ThemeClassNames.page.blogPostPage,
|
|
99
|
+
)}>
|
|
100
|
+
<BlogPostPageMetadata {...props} />
|
|
101
|
+
<BlogPostPageContent {...props} />
|
|
102
|
+
</HtmlClassNameProvider>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
@@ -11,25 +11,29 @@ import BlogLayout from '@theme/BlogLayout';
|
|
|
11
11
|
import TagsListByLetter from '@theme/TagsListByLetter';
|
|
12
12
|
import type {Props} from '@theme/BlogTagsListPage';
|
|
13
13
|
import {
|
|
14
|
+
PageMetadata,
|
|
15
|
+
HtmlClassNameProvider,
|
|
14
16
|
ThemeClassNames,
|
|
15
17
|
translateTagsPageTitle,
|
|
16
18
|
} from '@docusaurus/theme-common';
|
|
19
|
+
import SearchMetadata from '../SearchMetadata';
|
|
20
|
+
import clsx from 'clsx';
|
|
17
21
|
|
|
18
22
|
export default function BlogTagsListPage(props: Props): JSX.Element {
|
|
19
23
|
const {tags, sidebar} = props;
|
|
20
24
|
const title = translateTagsPageTitle();
|
|
21
25
|
return (
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
</
|
|
26
|
+
<HtmlClassNameProvider
|
|
27
|
+
className={clsx(
|
|
28
|
+
ThemeClassNames.wrapper.blogPages,
|
|
29
|
+
ThemeClassNames.page.blogTagsListPage,
|
|
30
|
+
)}>
|
|
31
|
+
<PageMetadata title={title} />
|
|
32
|
+
<SearchMetadata tag="blog_tags_list" />
|
|
33
|
+
<BlogLayout sidebar={sidebar}>
|
|
34
|
+
<h1>{title}</h1>
|
|
35
|
+
<TagsListByLetter tags={Object.values(tags)} />
|
|
36
|
+
</BlogLayout>
|
|
37
|
+
</HtmlClassNameProvider>
|
|
34
38
|
);
|
|
35
39
|
}
|
|
@@ -12,8 +12,15 @@ import BlogLayout from '@theme/BlogLayout';
|
|
|
12
12
|
import BlogPostItem from '@theme/BlogPostItem';
|
|
13
13
|
import type {Props} from '@theme/BlogTagsPostsPage';
|
|
14
14
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
PageMetadata,
|
|
17
|
+
HtmlClassNameProvider,
|
|
18
|
+
ThemeClassNames,
|
|
19
|
+
usePluralForm,
|
|
20
|
+
} from '@docusaurus/theme-common';
|
|
16
21
|
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
22
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
23
|
+
import clsx from 'clsx';
|
|
17
24
|
|
|
18
25
|
// Very simple pluralization: probably good enough for now
|
|
19
26
|
function useBlogPostsPlural() {
|
|
@@ -47,38 +54,38 @@ export default function BlogTagsPostsPage(props: Props): JSX.Element {
|
|
|
47
54
|
);
|
|
48
55
|
|
|
49
56
|
return (
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<h1>{title}</h1>
|
|
57
|
+
<HtmlClassNameProvider
|
|
58
|
+
className={clsx(
|
|
59
|
+
ThemeClassNames.wrapper.blogPages,
|
|
60
|
+
ThemeClassNames.page.blogTagPostListPage,
|
|
61
|
+
)}>
|
|
62
|
+
<PageMetadata title={title} />
|
|
63
|
+
<SearchMetadata tag="blog_tags_posts" />
|
|
64
|
+
<BlogLayout sidebar={sidebar}>
|
|
65
|
+
<header className="margin-bottom--xl">
|
|
66
|
+
<h1>{title}</h1>
|
|
61
67
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
<Link href={allTagsPath}>
|
|
69
|
+
<Translate
|
|
70
|
+
id="theme.tags.tagsPageLink"
|
|
71
|
+
description="The label of the link targeting the tag list page">
|
|
72
|
+
View All Tags
|
|
73
|
+
</Translate>
|
|
74
|
+
</Link>
|
|
75
|
+
</header>
|
|
70
76
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
{items.map(({content: BlogPostContent}) => (
|
|
78
|
+
<BlogPostItem
|
|
79
|
+
key={BlogPostContent.metadata.permalink}
|
|
80
|
+
frontMatter={BlogPostContent.frontMatter}
|
|
81
|
+
assets={BlogPostContent.assets}
|
|
82
|
+
metadata={BlogPostContent.metadata}
|
|
83
|
+
truncated>
|
|
84
|
+
<BlogPostContent />
|
|
85
|
+
</BlogPostItem>
|
|
86
|
+
))}
|
|
87
|
+
<BlogListPaginator metadata={listMetadata} />
|
|
88
|
+
</BlogLayout>
|
|
89
|
+
</HtmlClassNameProvider>
|
|
83
90
|
);
|
|
84
91
|
}
|
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
PageMetadata,
|
|
11
|
+
useCurrentSidebarCategory,
|
|
12
|
+
} from '@docusaurus/theme-common';
|
|
10
13
|
import type {Props} from '@theme/DocCategoryGeneratedIndexPage';
|
|
11
14
|
import DocCardList from '@theme/DocCardList';
|
|
12
15
|
import DocPaginator from '@theme/DocPaginator';
|
|
13
|
-
import Seo from '@theme/Seo';
|
|
14
16
|
import DocVersionBanner from '@theme/DocVersionBanner';
|
|
15
17
|
import DocVersionBadge from '@theme/DocVersionBadge';
|
|
16
18
|
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
|
|
@@ -19,13 +21,27 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
|
19
21
|
|
|
20
22
|
import styles from './styles.module.css';
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
function DocCategoryGeneratedIndexPageMetadata({
|
|
25
|
+
categoryGeneratedIndex,
|
|
26
|
+
}: Props): JSX.Element {
|
|
27
|
+
return (
|
|
28
|
+
<PageMetadata
|
|
29
|
+
title={categoryGeneratedIndex.title}
|
|
30
|
+
description={categoryGeneratedIndex.description}
|
|
31
|
+
keywords={categoryGeneratedIndex.keywords}
|
|
32
|
+
// TODO `require` this?
|
|
33
|
+
image={useBaseUrl(categoryGeneratedIndex.image)}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function DocCategoryGeneratedIndexPageContent({
|
|
23
39
|
categoryGeneratedIndex,
|
|
24
40
|
}: Props): JSX.Element {
|
|
25
41
|
const category = useCurrentSidebarCategory();
|
|
26
42
|
return (
|
|
27
43
|
<>
|
|
28
|
-
<
|
|
44
|
+
<PageMetadata
|
|
29
45
|
title={categoryGeneratedIndex.title}
|
|
30
46
|
description={categoryGeneratedIndex.description}
|
|
31
47
|
keywords={categoryGeneratedIndex.keywords}
|
|
@@ -57,3 +73,14 @@ export default function DocCategoryGeneratedIndexPage({
|
|
|
57
73
|
</>
|
|
58
74
|
);
|
|
59
75
|
}
|
|
76
|
+
|
|
77
|
+
export default function DocCategoryGeneratedIndexPage(
|
|
78
|
+
props: Props,
|
|
79
|
+
): JSX.Element {
|
|
80
|
+
return (
|
|
81
|
+
<>
|
|
82
|
+
<DocCategoryGeneratedIndexPageMetadata {...props} />
|
|
83
|
+
<DocCategoryGeneratedIndexPageContent {...props} />
|
|
84
|
+
</>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
@@ -10,7 +10,6 @@ import clsx from 'clsx';
|
|
|
10
10
|
import DocPaginator from '@theme/DocPaginator';
|
|
11
11
|
import DocVersionBanner from '@theme/DocVersionBanner';
|
|
12
12
|
import DocVersionBadge from '@theme/DocVersionBadge';
|
|
13
|
-
import Seo from '@theme/Seo';
|
|
14
13
|
import type {Props} from '@theme/DocItem';
|
|
15
14
|
import DocItemFooter from '@theme/DocItemFooter';
|
|
16
15
|
import TOC from '@theme/TOC';
|
|
@@ -18,6 +17,7 @@ import TOCCollapsible from '@theme/TOCCollapsible';
|
|
|
18
17
|
import Heading from '@theme/Heading';
|
|
19
18
|
import styles from './styles.module.css';
|
|
20
19
|
import {
|
|
20
|
+
PageMetadata,
|
|
21
21
|
HtmlClassNameProvider,
|
|
22
22
|
ThemeClassNames,
|
|
23
23
|
useWindowSize,
|
|
@@ -25,18 +25,26 @@ import {
|
|
|
25
25
|
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
|
|
26
26
|
import MDXContent from '@theme/MDXContent';
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
function DocItemMetadata(props: Props): JSX.Element {
|
|
29
29
|
const {content: DocContent} = props;
|
|
30
30
|
const {metadata, frontMatter, assets} = DocContent;
|
|
31
|
+
const {keywords} = frontMatter;
|
|
32
|
+
const {description, title} = metadata;
|
|
33
|
+
const image = assets.image ?? frontMatter.image;
|
|
34
|
+
|
|
35
|
+
return <PageMetadata {...{title, description, keywords, image}} />;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function DocItemContent(props: Props): JSX.Element {
|
|
39
|
+
const {content: DocContent} = props;
|
|
40
|
+
const {metadata, frontMatter} = DocContent;
|
|
31
41
|
const {
|
|
32
|
-
keywords,
|
|
33
42
|
hide_title: hideTitle,
|
|
34
43
|
hide_table_of_contents: hideTableOfContents,
|
|
35
44
|
toc_min_heading_level: tocMinHeadingLevel,
|
|
36
45
|
toc_max_heading_level: tocMaxHeadingLevel,
|
|
37
46
|
} = frontMatter;
|
|
38
|
-
const {
|
|
39
|
-
const image = assets.image ?? frontMatter.image;
|
|
47
|
+
const {title} = metadata;
|
|
40
48
|
|
|
41
49
|
// We only add a title if:
|
|
42
50
|
// - user asks to hide it with front matter
|
|
@@ -53,64 +61,69 @@ export default function DocItem(props: Props): JSX.Element {
|
|
|
53
61
|
canRenderTOC && (windowSize === 'desktop' || windowSize === 'ssr');
|
|
54
62
|
|
|
55
63
|
return (
|
|
56
|
-
<
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<article>
|
|
64
|
-
<DocBreadcrumbs />
|
|
65
|
-
<DocVersionBadge />
|
|
64
|
+
<div className="row">
|
|
65
|
+
<div className={clsx('col', !hideTableOfContents && styles.docItemCol)}>
|
|
66
|
+
<DocVersionBanner />
|
|
67
|
+
<div className={styles.docItemContainer}>
|
|
68
|
+
<article>
|
|
69
|
+
<DocBreadcrumbs />
|
|
70
|
+
<DocVersionBadge />
|
|
66
71
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
{canRenderTOC && (
|
|
73
|
+
<TOCCollapsible
|
|
74
|
+
toc={DocContent.toc}
|
|
75
|
+
minHeadingLevel={tocMinHeadingLevel}
|
|
76
|
+
maxHeadingLevel={tocMaxHeadingLevel}
|
|
77
|
+
className={clsx(
|
|
78
|
+
ThemeClassNames.docs.docTocMobile,
|
|
79
|
+
styles.tocMobile,
|
|
80
|
+
)}
|
|
81
|
+
/>
|
|
82
|
+
)}
|
|
78
83
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
{/*
|
|
84
|
+
<div className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown')}>
|
|
85
|
+
{/*
|
|
82
86
|
Title can be declared inside md content or declared through
|
|
83
87
|
front matter and added manually. To make both cases consistent,
|
|
84
88
|
the added title is added under the same div.markdown block
|
|
85
89
|
See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
|
|
86
90
|
*/}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
{shouldAddTitle && (
|
|
92
|
+
<header>
|
|
93
|
+
<Heading as="h1">{title}</Heading>
|
|
94
|
+
</header>
|
|
95
|
+
)}
|
|
96
|
+
<MDXContent>
|
|
97
|
+
<DocContent />
|
|
98
|
+
</MDXContent>
|
|
99
|
+
</div>
|
|
96
100
|
|
|
97
|
-
|
|
98
|
-
|
|
101
|
+
<DocItemFooter {...props} />
|
|
102
|
+
</article>
|
|
99
103
|
|
|
100
|
-
|
|
101
|
-
</div>
|
|
104
|
+
<DocPaginator previous={metadata.previous} next={metadata.next} />
|
|
102
105
|
</div>
|
|
103
|
-
{renderTocDesktop && (
|
|
104
|
-
<div className="col col--3">
|
|
105
|
-
<TOC
|
|
106
|
-
toc={DocContent.toc}
|
|
107
|
-
minHeadingLevel={tocMinHeadingLevel}
|
|
108
|
-
maxHeadingLevel={tocMaxHeadingLevel}
|
|
109
|
-
className={ThemeClassNames.docs.docTocDesktop}
|
|
110
|
-
/>
|
|
111
|
-
</div>
|
|
112
|
-
)}
|
|
113
106
|
</div>
|
|
107
|
+
{renderTocDesktop && (
|
|
108
|
+
<div className="col col--3">
|
|
109
|
+
<TOC
|
|
110
|
+
toc={DocContent.toc}
|
|
111
|
+
minHeadingLevel={tocMinHeadingLevel}
|
|
112
|
+
maxHeadingLevel={tocMaxHeadingLevel}
|
|
113
|
+
className={ThemeClassNames.docs.docTocDesktop}
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
)}
|
|
117
|
+
</div>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export default function DocItem(props: Props): JSX.Element {
|
|
122
|
+
const docHtmlClassName = `docs-doc-id-${props.content.metadata.unversionedId}`;
|
|
123
|
+
return (
|
|
124
|
+
<HtmlClassNameProvider className={docHtmlClassName}>
|
|
125
|
+
<DocItemMetadata {...props} />
|
|
126
|
+
<DocItemContent {...props} />
|
|
114
127
|
</HtmlClassNameProvider>
|
|
115
128
|
);
|
|
116
129
|
}
|