@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/lib/theme-classic.d.ts
CHANGED
|
@@ -364,31 +364,17 @@ declare module '@theme/Layout' {
|
|
|
364
364
|
|
|
365
365
|
export interface Props {
|
|
366
366
|
readonly children?: ReactNode;
|
|
367
|
-
readonly title?: string;
|
|
368
367
|
readonly noFooter?: boolean;
|
|
369
|
-
readonly description?: string;
|
|
370
|
-
readonly image?: string;
|
|
371
|
-
readonly keywords?: string | string[];
|
|
372
|
-
readonly permalink?: string;
|
|
373
368
|
readonly wrapperClassName?: string;
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
};
|
|
369
|
+
|
|
370
|
+
// Not really layout-related, but kept for convenience/retro-compatibility
|
|
371
|
+
readonly title?: string;
|
|
372
|
+
readonly description?: string;
|
|
379
373
|
}
|
|
380
374
|
|
|
381
375
|
export default function Layout(props: Props): JSX.Element;
|
|
382
376
|
}
|
|
383
377
|
|
|
384
|
-
declare module '@theme/LayoutHead' {
|
|
385
|
-
import type {Props as LayoutProps} from '@theme/Layout';
|
|
386
|
-
|
|
387
|
-
export interface Props extends Omit<LayoutProps, 'children'> {}
|
|
388
|
-
|
|
389
|
-
export default function LayoutHead(props: Props): JSX.Element;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
378
|
declare module '@theme/LayoutProviders' {
|
|
393
379
|
import type {ReactNode} from 'react';
|
|
394
380
|
|
|
@@ -480,7 +466,7 @@ declare module '@theme/Navbar/Content' {
|
|
|
480
466
|
|
|
481
467
|
declare module '@theme/Navbar/Layout' {
|
|
482
468
|
export interface Props {
|
|
483
|
-
children: React.ReactNode;
|
|
469
|
+
readonly children: React.ReactNode;
|
|
484
470
|
}
|
|
485
471
|
|
|
486
472
|
export default function NavbarLayout(props: Props): JSX.Element;
|
|
@@ -927,17 +913,3 @@ declare module '@theme/prism-include-languages' {
|
|
|
927
913
|
PrismObject: typeof PrismNamespace,
|
|
928
914
|
): void;
|
|
929
915
|
}
|
|
930
|
-
|
|
931
|
-
declare module '@theme/Seo' {
|
|
932
|
-
import type {ReactNode} from 'react';
|
|
933
|
-
|
|
934
|
-
export interface Props {
|
|
935
|
-
readonly title?: string;
|
|
936
|
-
readonly description?: string;
|
|
937
|
-
readonly keywords?: readonly string[] | string;
|
|
938
|
-
readonly image?: string;
|
|
939
|
-
readonly children?: ReactNode;
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
export default function Seo(props: Props): JSX.Element;
|
|
943
|
-
}
|
|
@@ -8,6 +8,7 @@ import React from 'react';
|
|
|
8
8
|
import Layout from '@theme/Layout';
|
|
9
9
|
import Link from '@docusaurus/Link';
|
|
10
10
|
import {translate} from '@docusaurus/Translate';
|
|
11
|
+
import {PageMetadata} from '@docusaurus/theme-common';
|
|
11
12
|
|
|
12
13
|
function Year({year, posts}) {
|
|
13
14
|
return (
|
|
@@ -67,14 +68,17 @@ export default function BlogArchive({archive}) {
|
|
|
67
68
|
});
|
|
68
69
|
const years = listPostsByYears(archive.blogPosts);
|
|
69
70
|
return (
|
|
70
|
-
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
<>
|
|
72
|
+
<PageMetadata title={title} description={description} />
|
|
73
|
+
<Layout>
|
|
74
|
+
<header className="hero hero--primary">
|
|
75
|
+
<div className="container">
|
|
76
|
+
<h1 className="hero__title">{title}</h1>
|
|
77
|
+
<p className="hero__subtitle">{description}</p>
|
|
78
|
+
</div>
|
|
79
|
+
</header>
|
|
80
|
+
<main>{years.length > 0 && <YearsSection years={years} />}</main>
|
|
81
|
+
</Layout>
|
|
82
|
+
</>
|
|
79
83
|
);
|
|
80
84
|
}
|
|
@@ -9,9 +9,16 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
|
9
9
|
import BlogLayout from '@theme/BlogLayout';
|
|
10
10
|
import BlogPostItem from '@theme/BlogPostItem';
|
|
11
11
|
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
import {
|
|
13
|
+
PageMetadata,
|
|
14
|
+
HtmlClassNameProvider,
|
|
15
|
+
ThemeClassNames,
|
|
16
|
+
} from '@docusaurus/theme-common';
|
|
17
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
18
|
+
import clsx from 'clsx';
|
|
19
|
+
|
|
20
|
+
function BlogListPageMetadata(props) {
|
|
21
|
+
const {metadata} = props;
|
|
15
22
|
const {
|
|
16
23
|
siteConfig: {title: siteTitle},
|
|
17
24
|
} = useDocusaurusContext();
|
|
@@ -19,16 +26,17 @@ export default function BlogListPage(props) {
|
|
|
19
26
|
const isBlogOnlyMode = permalink === '/';
|
|
20
27
|
const title = isBlogOnlyMode ? siteTitle : blogTitle;
|
|
21
28
|
return (
|
|
22
|
-
|
|
23
|
-
title={title}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
<>
|
|
30
|
+
<PageMetadata title={title} description={blogDescription} />
|
|
31
|
+
<SearchMetadata tag="blog_posts_list" />
|
|
32
|
+
</>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function BlogListPageContent(props) {
|
|
37
|
+
const {metadata, items, sidebar} = props;
|
|
38
|
+
return (
|
|
39
|
+
<BlogLayout sidebar={sidebar}>
|
|
32
40
|
{items.map(({content: BlogPostContent}) => (
|
|
33
41
|
<BlogPostItem
|
|
34
42
|
key={BlogPostContent.metadata.permalink}
|
|
@@ -43,3 +51,16 @@ export default function BlogListPage(props) {
|
|
|
43
51
|
</BlogLayout>
|
|
44
52
|
);
|
|
45
53
|
}
|
|
54
|
+
|
|
55
|
+
export default function BlogListPage(props) {
|
|
56
|
+
return (
|
|
57
|
+
<HtmlClassNameProvider
|
|
58
|
+
className={clsx(
|
|
59
|
+
ThemeClassNames.wrapper.blogPages,
|
|
60
|
+
ThemeClassNames.page.blogListPage,
|
|
61
|
+
)}>
|
|
62
|
+
<BlogListPageMetadata {...props} />
|
|
63
|
+
<BlogListPageContent {...props} />
|
|
64
|
+
</HtmlClassNameProvider>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
@@ -5,36 +5,62 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import Seo from '@theme/Seo';
|
|
9
8
|
import BlogLayout from '@theme/BlogLayout';
|
|
10
9
|
import BlogPostItem from '@theme/BlogPostItem';
|
|
11
10
|
import BlogPostPaginator from '@theme/BlogPostPaginator';
|
|
12
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
PageMetadata,
|
|
13
|
+
HtmlClassNameProvider,
|
|
14
|
+
ThemeClassNames,
|
|
15
|
+
} from '@docusaurus/theme-common';
|
|
13
16
|
import TOC from '@theme/TOC';
|
|
14
|
-
|
|
17
|
+
import clsx from 'clsx';
|
|
18
|
+
|
|
19
|
+
function BlogPostPageMetadata(props) {
|
|
20
|
+
const {content: BlogPostContents} = props;
|
|
21
|
+
const {assets, metadata} = BlogPostContents;
|
|
22
|
+
const {title, description, date, tags, authors, frontMatter} = metadata;
|
|
23
|
+
const {keywords} = frontMatter;
|
|
24
|
+
const image = assets.image ?? frontMatter.image;
|
|
25
|
+
return (
|
|
26
|
+
<PageMetadata
|
|
27
|
+
title={title}
|
|
28
|
+
description={description}
|
|
29
|
+
keywords={keywords}
|
|
30
|
+
image={image}>
|
|
31
|
+
<meta property="og:type" content="article" />
|
|
32
|
+
<meta property="article:published_time" content={date} />
|
|
33
|
+
{/* TODO double check those article meta array syntaxes, see https://ogp.me/#array */}
|
|
34
|
+
{authors.some((author) => author.url) && (
|
|
35
|
+
<meta
|
|
36
|
+
property="article:author"
|
|
37
|
+
content={authors
|
|
38
|
+
.map((author) => author.url)
|
|
39
|
+
.filter(Boolean)
|
|
40
|
+
.join(',')}
|
|
41
|
+
/>
|
|
42
|
+
)}
|
|
43
|
+
{tags.length > 0 && (
|
|
44
|
+
<meta
|
|
45
|
+
property="article:tag"
|
|
46
|
+
content={tags.map((tag) => tag.label).join(',')}
|
|
47
|
+
/>
|
|
48
|
+
)}
|
|
49
|
+
</PageMetadata>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function BlogPostPageContent(props) {
|
|
15
54
|
const {content: BlogPostContents, sidebar} = props;
|
|
16
55
|
const {assets, metadata} = BlogPostContents;
|
|
17
|
-
const {
|
|
18
|
-
title,
|
|
19
|
-
description,
|
|
20
|
-
nextItem,
|
|
21
|
-
prevItem,
|
|
22
|
-
date,
|
|
23
|
-
tags,
|
|
24
|
-
authors,
|
|
25
|
-
frontMatter,
|
|
26
|
-
} = metadata;
|
|
56
|
+
const {nextItem, prevItem, frontMatter} = metadata;
|
|
27
57
|
const {
|
|
28
58
|
hide_table_of_contents: hideTableOfContents,
|
|
29
|
-
keywords,
|
|
30
59
|
toc_min_heading_level: tocMinHeadingLevel,
|
|
31
60
|
toc_max_heading_level: tocMaxHeadingLevel,
|
|
32
61
|
} = frontMatter;
|
|
33
|
-
const image = assets.image ?? frontMatter.image;
|
|
34
62
|
return (
|
|
35
63
|
<BlogLayout
|
|
36
|
-
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
|
37
|
-
pageClassName={ThemeClassNames.page.blogPostPage}
|
|
38
64
|
sidebar={sidebar}
|
|
39
65
|
toc={
|
|
40
66
|
!hideTableOfContents &&
|
|
@@ -47,34 +73,6 @@ export default function BlogPostPage(props) {
|
|
|
47
73
|
/>
|
|
48
74
|
) : undefined
|
|
49
75
|
}>
|
|
50
|
-
<Seo // TODO refactor needed: it's a bit annoying but Seo MUST be inside
|
|
51
|
-
// BlogLayout, otherwise default image (set by BlogLayout) would shadow
|
|
52
|
-
// the custom blog post image
|
|
53
|
-
title={title}
|
|
54
|
-
description={description}
|
|
55
|
-
keywords={keywords}
|
|
56
|
-
image={image}>
|
|
57
|
-
<meta property="og:type" content="article" />
|
|
58
|
-
<meta property="article:published_time" content={date} />
|
|
59
|
-
|
|
60
|
-
{/* TODO double check those article meta array syntaxes, see https://ogp.me/#array */}
|
|
61
|
-
{authors.some((author) => author.url) && (
|
|
62
|
-
<meta
|
|
63
|
-
property="article:author"
|
|
64
|
-
content={authors
|
|
65
|
-
.map((author) => author.url)
|
|
66
|
-
.filter(Boolean)
|
|
67
|
-
.join(',')}
|
|
68
|
-
/>
|
|
69
|
-
)}
|
|
70
|
-
{tags.length > 0 && (
|
|
71
|
-
<meta
|
|
72
|
-
property="article:tag"
|
|
73
|
-
content={tags.map((tag) => tag.label).join(',')}
|
|
74
|
-
/>
|
|
75
|
-
)}
|
|
76
|
-
</Seo>
|
|
77
|
-
|
|
78
76
|
<BlogPostItem
|
|
79
77
|
frontMatter={frontMatter}
|
|
80
78
|
assets={assets}
|
|
@@ -89,3 +87,16 @@ export default function BlogPostPage(props) {
|
|
|
89
87
|
</BlogLayout>
|
|
90
88
|
);
|
|
91
89
|
}
|
|
90
|
+
|
|
91
|
+
export default function BlogPostPage(props) {
|
|
92
|
+
return (
|
|
93
|
+
<HtmlClassNameProvider
|
|
94
|
+
className={clsx(
|
|
95
|
+
ThemeClassNames.wrapper.blogPages,
|
|
96
|
+
ThemeClassNames.page.blogPostPage,
|
|
97
|
+
)}>
|
|
98
|
+
<BlogPostPageMetadata {...props} />
|
|
99
|
+
<BlogPostPageContent {...props} />
|
|
100
|
+
</HtmlClassNameProvider>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
@@ -8,24 +8,28 @@ import React from 'react';
|
|
|
8
8
|
import BlogLayout from '@theme/BlogLayout';
|
|
9
9
|
import TagsListByLetter from '@theme/TagsListByLetter';
|
|
10
10
|
import {
|
|
11
|
+
PageMetadata,
|
|
12
|
+
HtmlClassNameProvider,
|
|
11
13
|
ThemeClassNames,
|
|
12
14
|
translateTagsPageTitle,
|
|
13
15
|
} from '@docusaurus/theme-common';
|
|
16
|
+
import SearchMetadata from '../SearchMetadata';
|
|
17
|
+
import clsx from 'clsx';
|
|
14
18
|
export default function BlogTagsListPage(props) {
|
|
15
19
|
const {tags, sidebar} = props;
|
|
16
20
|
const title = translateTagsPageTitle();
|
|
17
21
|
return (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
</
|
|
22
|
+
<HtmlClassNameProvider
|
|
23
|
+
className={clsx(
|
|
24
|
+
ThemeClassNames.wrapper.blogPages,
|
|
25
|
+
ThemeClassNames.page.blogTagsListPage,
|
|
26
|
+
)}>
|
|
27
|
+
<PageMetadata title={title} />
|
|
28
|
+
<SearchMetadata tag="blog_tags_list" />
|
|
29
|
+
<BlogLayout sidebar={sidebar}>
|
|
30
|
+
<h1>{title}</h1>
|
|
31
|
+
<TagsListByLetter tags={Object.values(tags)} />
|
|
32
|
+
</BlogLayout>
|
|
33
|
+
</HtmlClassNameProvider>
|
|
30
34
|
);
|
|
31
35
|
}
|
|
@@ -9,8 +9,15 @@ import Link from '@docusaurus/Link';
|
|
|
9
9
|
import BlogLayout from '@theme/BlogLayout';
|
|
10
10
|
import BlogPostItem from '@theme/BlogPostItem';
|
|
11
11
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
12
|
-
import {
|
|
13
|
-
|
|
12
|
+
import {
|
|
13
|
+
PageMetadata,
|
|
14
|
+
HtmlClassNameProvider,
|
|
15
|
+
ThemeClassNames,
|
|
16
|
+
usePluralForm,
|
|
17
|
+
} from '@docusaurus/theme-common';
|
|
18
|
+
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
19
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
20
|
+
import clsx from 'clsx'; // Very simple pluralization: probably good enough for now
|
|
14
21
|
|
|
15
22
|
function useBlogPostsPlural() {
|
|
16
23
|
const {selectMessage} = usePluralForm();
|
|
@@ -47,38 +54,38 @@ export default function BlogTagsPostsPage(props) {
|
|
|
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
|
}
|
|
@@ -5,23 +5,35 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
PageMetadata,
|
|
10
|
+
useCurrentSidebarCategory,
|
|
11
|
+
} from '@docusaurus/theme-common';
|
|
9
12
|
import DocCardList from '@theme/DocCardList';
|
|
10
13
|
import DocPaginator from '@theme/DocPaginator';
|
|
11
|
-
import Seo from '@theme/Seo';
|
|
12
14
|
import DocVersionBanner from '@theme/DocVersionBanner';
|
|
13
15
|
import DocVersionBadge from '@theme/DocVersionBadge';
|
|
14
16
|
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
|
|
15
17
|
import Heading from '@theme/Heading';
|
|
16
18
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
17
19
|
import styles from './styles.module.css';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
function DocCategoryGeneratedIndexPageMetadata({categoryGeneratedIndex}) {
|
|
22
|
+
return (
|
|
23
|
+
<PageMetadata
|
|
24
|
+
title={categoryGeneratedIndex.title}
|
|
25
|
+
description={categoryGeneratedIndex.description}
|
|
26
|
+
keywords={categoryGeneratedIndex.keywords} // TODO `require` this?
|
|
27
|
+
image={useBaseUrl(categoryGeneratedIndex.image)}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function DocCategoryGeneratedIndexPageContent({categoryGeneratedIndex}) {
|
|
21
33
|
const category = useCurrentSidebarCategory();
|
|
22
34
|
return (
|
|
23
35
|
<>
|
|
24
|
-
<
|
|
36
|
+
<PageMetadata
|
|
25
37
|
title={categoryGeneratedIndex.title}
|
|
26
38
|
description={categoryGeneratedIndex.description}
|
|
27
39
|
keywords={categoryGeneratedIndex.keywords} // TODO `require` this?
|
|
@@ -52,3 +64,12 @@ export default function DocCategoryGeneratedIndexPage({
|
|
|
52
64
|
</>
|
|
53
65
|
);
|
|
54
66
|
}
|
|
67
|
+
|
|
68
|
+
export default function DocCategoryGeneratedIndexPage(props) {
|
|
69
|
+
return (
|
|
70
|
+
<>
|
|
71
|
+
<DocCategoryGeneratedIndexPageMetadata {...props} />
|
|
72
|
+
<DocCategoryGeneratedIndexPageContent {...props} />
|
|
73
|
+
</>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
@@ -9,31 +9,48 @@ import clsx from 'clsx';
|
|
|
9
9
|
import DocPaginator from '@theme/DocPaginator';
|
|
10
10
|
import DocVersionBanner from '@theme/DocVersionBanner';
|
|
11
11
|
import DocVersionBadge from '@theme/DocVersionBadge';
|
|
12
|
-
import Seo from '@theme/Seo';
|
|
13
12
|
import DocItemFooter from '@theme/DocItemFooter';
|
|
14
13
|
import TOC from '@theme/TOC';
|
|
15
14
|
import TOCCollapsible from '@theme/TOCCollapsible';
|
|
16
15
|
import Heading from '@theme/Heading';
|
|
17
16
|
import styles from './styles.module.css';
|
|
18
17
|
import {
|
|
18
|
+
PageMetadata,
|
|
19
19
|
HtmlClassNameProvider,
|
|
20
20
|
ThemeClassNames,
|
|
21
21
|
useWindowSize,
|
|
22
22
|
} from '@docusaurus/theme-common';
|
|
23
23
|
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
|
|
24
24
|
import MDXContent from '@theme/MDXContent';
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
function DocItemMetadata(props) {
|
|
26
27
|
const {content: DocContent} = props;
|
|
27
28
|
const {metadata, frontMatter, assets} = DocContent;
|
|
29
|
+
const {keywords} = frontMatter;
|
|
30
|
+
const {description, title} = metadata;
|
|
31
|
+
const image = assets.image ?? frontMatter.image;
|
|
32
|
+
return (
|
|
33
|
+
<PageMetadata
|
|
34
|
+
{...{
|
|
35
|
+
title,
|
|
36
|
+
description,
|
|
37
|
+
keywords,
|
|
38
|
+
image,
|
|
39
|
+
}}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function DocItemContent(props) {
|
|
45
|
+
const {content: DocContent} = props;
|
|
46
|
+
const {metadata, frontMatter} = DocContent;
|
|
28
47
|
const {
|
|
29
|
-
keywords,
|
|
30
48
|
hide_title: hideTitle,
|
|
31
49
|
hide_table_of_contents: hideTableOfContents,
|
|
32
50
|
toc_min_heading_level: tocMinHeadingLevel,
|
|
33
51
|
toc_max_heading_level: tocMaxHeadingLevel,
|
|
34
52
|
} = frontMatter;
|
|
35
|
-
const {
|
|
36
|
-
const image = assets.image ?? frontMatter.image; // We only add a title if:
|
|
53
|
+
const {title} = metadata; // We only add a title if:
|
|
37
54
|
// - user asks to hide it with front matter
|
|
38
55
|
// - the markdown content does not already contain a top-level h1 heading
|
|
39
56
|
|
|
@@ -45,71 +62,69 @@ export default function DocItem(props) {
|
|
|
45
62
|
const renderTocDesktop =
|
|
46
63
|
canRenderTOC && (windowSize === 'desktop' || windowSize === 'ssr');
|
|
47
64
|
return (
|
|
48
|
-
<
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}}
|
|
56
|
-
/>
|
|
65
|
+
<div className="row">
|
|
66
|
+
<div className={clsx('col', !hideTableOfContents && styles.docItemCol)}>
|
|
67
|
+
<DocVersionBanner />
|
|
68
|
+
<div className={styles.docItemContainer}>
|
|
69
|
+
<article>
|
|
70
|
+
<DocBreadcrumbs />
|
|
71
|
+
<DocVersionBadge />
|
|
57
72
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
73
|
+
{canRenderTOC && (
|
|
74
|
+
<TOCCollapsible
|
|
75
|
+
toc={DocContent.toc}
|
|
76
|
+
minHeadingLevel={tocMinHeadingLevel}
|
|
77
|
+
maxHeadingLevel={tocMaxHeadingLevel}
|
|
78
|
+
className={clsx(
|
|
79
|
+
ThemeClassNames.docs.docTocMobile,
|
|
80
|
+
styles.tocMobile,
|
|
81
|
+
)}
|
|
82
|
+
/>
|
|
83
|
+
)}
|
|
65
84
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
<div className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown')}>
|
|
86
|
+
{/*
|
|
87
|
+
Title can be declared inside md content or declared through
|
|
88
|
+
front matter and added manually. To make both cases consistent,
|
|
89
|
+
the added title is added under the same div.markdown block
|
|
90
|
+
See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
|
|
91
|
+
*/}
|
|
92
|
+
{shouldAddTitle && (
|
|
93
|
+
<header>
|
|
94
|
+
<Heading as="h1">{title}</Heading>
|
|
95
|
+
</header>
|
|
76
96
|
)}
|
|
97
|
+
<MDXContent>
|
|
98
|
+
<DocContent />
|
|
99
|
+
</MDXContent>
|
|
100
|
+
</div>
|
|
77
101
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
{/*
|
|
81
|
-
Title can be declared inside md content or declared through
|
|
82
|
-
front matter and added manually. To make both cases consistent,
|
|
83
|
-
the added title is added under the same div.markdown block
|
|
84
|
-
See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
|
|
85
|
-
*/}
|
|
86
|
-
{shouldAddTitle && (
|
|
87
|
-
<header>
|
|
88
|
-
<Heading as="h1">{title}</Heading>
|
|
89
|
-
</header>
|
|
90
|
-
)}
|
|
91
|
-
<MDXContent>
|
|
92
|
-
<DocContent />
|
|
93
|
-
</MDXContent>
|
|
94
|
-
</div>
|
|
95
|
-
|
|
96
|
-
<DocItemFooter {...props} />
|
|
97
|
-
</article>
|
|
102
|
+
<DocItemFooter {...props} />
|
|
103
|
+
</article>
|
|
98
104
|
|
|
99
|
-
|
|
100
|
-
</div>
|
|
105
|
+
<DocPaginator previous={metadata.previous} next={metadata.next} />
|
|
101
106
|
</div>
|
|
102
|
-
{renderTocDesktop && (
|
|
103
|
-
<div className="col col--3">
|
|
104
|
-
<TOC
|
|
105
|
-
toc={DocContent.toc}
|
|
106
|
-
minHeadingLevel={tocMinHeadingLevel}
|
|
107
|
-
maxHeadingLevel={tocMaxHeadingLevel}
|
|
108
|
-
className={ThemeClassNames.docs.docTocDesktop}
|
|
109
|
-
/>
|
|
110
|
-
</div>
|
|
111
|
-
)}
|
|
112
107
|
</div>
|
|
108
|
+
{renderTocDesktop && (
|
|
109
|
+
<div className="col col--3">
|
|
110
|
+
<TOC
|
|
111
|
+
toc={DocContent.toc}
|
|
112
|
+
minHeadingLevel={tocMinHeadingLevel}
|
|
113
|
+
maxHeadingLevel={tocMaxHeadingLevel}
|
|
114
|
+
className={ThemeClassNames.docs.docTocDesktop}
|
|
115
|
+
/>
|
|
116
|
+
</div>
|
|
117
|
+
)}
|
|
118
|
+
</div>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export default function DocItem(props) {
|
|
123
|
+
const docHtmlClassName = `docs-doc-id-${props.content.metadata.unversionedId}`;
|
|
124
|
+
return (
|
|
125
|
+
<HtmlClassNameProvider className={docHtmlClassName}>
|
|
126
|
+
<DocItemMetadata {...props} />
|
|
127
|
+
<DocItemContent {...props} />
|
|
113
128
|
</HtmlClassNameProvider>
|
|
114
129
|
);
|
|
115
130
|
}
|