@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
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
useDocsSidebar,
|
|
30
30
|
DocsVersionProvider,
|
|
31
31
|
} from '@docusaurus/theme-common';
|
|
32
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
32
33
|
|
|
33
34
|
type DocPageContentProps = {
|
|
34
35
|
readonly currentDocRoute: DocumentRoute;
|
|
@@ -56,87 +57,89 @@ function DocPageContent({
|
|
|
56
57
|
}, [hiddenSidebar]);
|
|
57
58
|
|
|
58
59
|
return (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<BackToTopButton />
|
|
60
|
+
<>
|
|
61
|
+
<SearchMetadata
|
|
62
|
+
version={version}
|
|
63
|
+
tag={docVersionSearchTag(pluginId, version)}
|
|
64
|
+
/>
|
|
65
|
+
<Layout>
|
|
66
|
+
<div className={styles.docPage}>
|
|
67
|
+
<BackToTopButton />
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
69
|
+
{sidebar && (
|
|
70
|
+
<aside
|
|
71
|
+
className={clsx(
|
|
72
|
+
ThemeClassNames.docs.docSidebarContainer,
|
|
73
|
+
styles.docSidebarContainer,
|
|
74
|
+
hiddenSidebarContainer && styles.docSidebarContainerHidden,
|
|
75
|
+
)}
|
|
76
|
+
onTransitionEnd={(e) => {
|
|
77
|
+
if (
|
|
78
|
+
!e.currentTarget.classList.contains(
|
|
79
|
+
styles.docSidebarContainer!,
|
|
80
|
+
)
|
|
81
|
+
) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
82
84
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
85
|
+
if (hiddenSidebarContainer) {
|
|
86
|
+
setHiddenSidebar(true);
|
|
87
|
+
}
|
|
88
|
+
}}>
|
|
89
|
+
<DocSidebar
|
|
90
|
+
key={
|
|
91
|
+
// Reset sidebar state on sidebar changes
|
|
92
|
+
// See https://github.com/facebook/docusaurus/issues/3414
|
|
93
|
+
sidebarName
|
|
94
|
+
}
|
|
95
|
+
sidebar={sidebar}
|
|
96
|
+
path={currentDocRoute.path}
|
|
97
|
+
onCollapse={toggleSidebar}
|
|
98
|
+
isHidden={hiddenSidebar}
|
|
99
|
+
/>
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
className={clsx(
|
|
125
|
-
styles.docMainContainer,
|
|
126
|
-
(hiddenSidebarContainer || !sidebar) &&
|
|
127
|
-
styles.docMainContainerEnhanced,
|
|
128
|
-
)}>
|
|
129
|
-
<div
|
|
101
|
+
{hiddenSidebar && (
|
|
102
|
+
<div
|
|
103
|
+
className={styles.collapsedDocSidebar}
|
|
104
|
+
title={translate({
|
|
105
|
+
id: 'theme.docs.sidebar.expandButtonTitle',
|
|
106
|
+
message: 'Expand sidebar',
|
|
107
|
+
description:
|
|
108
|
+
'The ARIA label and title attribute for expand button of doc sidebar',
|
|
109
|
+
})}
|
|
110
|
+
aria-label={translate({
|
|
111
|
+
id: 'theme.docs.sidebar.expandButtonAriaLabel',
|
|
112
|
+
message: 'Expand sidebar',
|
|
113
|
+
description:
|
|
114
|
+
'The ARIA label and title attribute for expand button of doc sidebar',
|
|
115
|
+
})}
|
|
116
|
+
tabIndex={0}
|
|
117
|
+
role="button"
|
|
118
|
+
onKeyDown={toggleSidebar}
|
|
119
|
+
onClick={toggleSidebar}>
|
|
120
|
+
<IconArrow className={styles.expandSidebarButtonIcon} />
|
|
121
|
+
</div>
|
|
122
|
+
)}
|
|
123
|
+
</aside>
|
|
124
|
+
)}
|
|
125
|
+
<main
|
|
130
126
|
className={clsx(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
127
|
+
styles.docMainContainer,
|
|
128
|
+
(hiddenSidebarContainer || !sidebar) &&
|
|
129
|
+
styles.docMainContainerEnhanced,
|
|
134
130
|
)}>
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
131
|
+
<div
|
|
132
|
+
className={clsx(
|
|
133
|
+
'container padding-top--md padding-bottom--lg',
|
|
134
|
+
styles.docItemWrapper,
|
|
135
|
+
hiddenSidebarContainer && styles.docItemWrapperEnhanced,
|
|
136
|
+
)}>
|
|
137
|
+
{children}
|
|
138
|
+
</div>
|
|
139
|
+
</main>
|
|
140
|
+
</div>
|
|
141
|
+
</Layout>
|
|
142
|
+
</>
|
|
140
143
|
);
|
|
141
144
|
}
|
|
142
145
|
|
|
@@ -161,7 +164,12 @@ export default function DocPage(props: Props): JSX.Element {
|
|
|
161
164
|
: null;
|
|
162
165
|
|
|
163
166
|
return (
|
|
164
|
-
<HtmlClassNameProvider
|
|
167
|
+
<HtmlClassNameProvider
|
|
168
|
+
className={clsx(
|
|
169
|
+
ThemeClassNames.wrapper.docsPages,
|
|
170
|
+
ThemeClassNames.page.docsDocPage,
|
|
171
|
+
versionMetadata.className,
|
|
172
|
+
)}>
|
|
165
173
|
<DocsVersionProvider version={versionMetadata}>
|
|
166
174
|
<DocsSidebarProvider sidebar={sidebar ?? null}>
|
|
167
175
|
<DocPageContent
|
|
@@ -9,10 +9,17 @@ import React from 'react';
|
|
|
9
9
|
|
|
10
10
|
import Layout from '@theme/Layout';
|
|
11
11
|
import Link from '@docusaurus/Link';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
PageMetadata,
|
|
14
|
+
HtmlClassNameProvider,
|
|
15
|
+
ThemeClassNames,
|
|
16
|
+
usePluralForm,
|
|
17
|
+
} from '@docusaurus/theme-common';
|
|
13
18
|
import type {PropTagDocListDoc} from '@docusaurus/plugin-content-docs';
|
|
14
19
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
15
20
|
import type {Props} from '@theme/DocTagDocListPage';
|
|
21
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
22
|
+
import clsx from 'clsx';
|
|
16
23
|
|
|
17
24
|
// Very simple pluralization: probably good enough for now
|
|
18
25
|
function useNDocsTaggedPlural() {
|
|
@@ -55,35 +62,36 @@ export default function DocTagDocListPage({tag}: Props): JSX.Element {
|
|
|
55
62
|
);
|
|
56
63
|
|
|
57
64
|
return (
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
65
|
+
<HtmlClassNameProvider
|
|
66
|
+
className={clsx(
|
|
67
|
+
ThemeClassNames.wrapper.docsPages,
|
|
68
|
+
ThemeClassNames.page.docsTagDocListPage,
|
|
69
|
+
)}>
|
|
70
|
+
<PageMetadata title={title} />
|
|
71
|
+
<SearchMetadata tag="doc_tag_doc_list" />
|
|
72
|
+
<Layout>
|
|
73
|
+
<div className="container margin-vert--lg">
|
|
74
|
+
<div className="row">
|
|
75
|
+
<main className="col col--8 col--offset-2">
|
|
76
|
+
<header className="margin-bottom--xl">
|
|
77
|
+
<h1>{title}</h1>
|
|
78
|
+
<Link href={tag.allTagsPath}>
|
|
79
|
+
<Translate
|
|
80
|
+
id="theme.tags.tagsPageLink"
|
|
81
|
+
description="The label of the link targeting the tag list page">
|
|
82
|
+
View All Tags
|
|
83
|
+
</Translate>
|
|
84
|
+
</Link>
|
|
85
|
+
</header>
|
|
86
|
+
<section className="margin-vert--lg">
|
|
87
|
+
{tag.docs.map((doc) => (
|
|
88
|
+
<DocItem key={doc.id} doc={doc} />
|
|
89
|
+
))}
|
|
90
|
+
</section>
|
|
91
|
+
</main>
|
|
92
|
+
</div>
|
|
85
93
|
</div>
|
|
86
|
-
</
|
|
87
|
-
</
|
|
94
|
+
</Layout>
|
|
95
|
+
</HtmlClassNameProvider>
|
|
88
96
|
);
|
|
89
97
|
}
|
|
@@ -9,31 +9,36 @@ import React from 'react';
|
|
|
9
9
|
|
|
10
10
|
import Layout from '@theme/Layout';
|
|
11
11
|
import {
|
|
12
|
+
PageMetadata,
|
|
13
|
+
HtmlClassNameProvider,
|
|
12
14
|
ThemeClassNames,
|
|
13
15
|
translateTagsPageTitle,
|
|
14
16
|
} from '@docusaurus/theme-common';
|
|
15
17
|
import TagsListByLetter from '@theme/TagsListByLetter';
|
|
16
18
|
import type {Props} from '@theme/DocTagsListPage';
|
|
19
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
20
|
+
import clsx from 'clsx';
|
|
17
21
|
|
|
18
22
|
export default function DocTagsListPage({tags}: Props): JSX.Element {
|
|
19
23
|
const title = translateTagsPageTitle();
|
|
20
24
|
return (
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
<HtmlClassNameProvider
|
|
26
|
+
className={clsx(
|
|
27
|
+
ThemeClassNames.wrapper.docsPages,
|
|
28
|
+
ThemeClassNames.page.docsTagsListPage,
|
|
29
|
+
)}>
|
|
30
|
+
<PageMetadata title={title} />
|
|
31
|
+
<SearchMetadata tag="doc_tags_list" />
|
|
32
|
+
<Layout>
|
|
33
|
+
<div className="container margin-vert--lg">
|
|
34
|
+
<div className="row">
|
|
35
|
+
<main className="col col--8 col--offset-2">
|
|
36
|
+
<h1>{title}</h1>
|
|
37
|
+
<TagsListByLetter tags={tags} />
|
|
38
|
+
</main>
|
|
39
|
+
</div>
|
|
35
40
|
</div>
|
|
36
|
-
</
|
|
37
|
-
</
|
|
41
|
+
</Layout>
|
|
42
|
+
</HtmlClassNameProvider>
|
|
38
43
|
);
|
|
39
44
|
}
|
|
@@ -13,20 +13,30 @@ import AnnouncementBar from '@theme/AnnouncementBar';
|
|
|
13
13
|
import Navbar from '@theme/Navbar';
|
|
14
14
|
import Footer from '@theme/Footer';
|
|
15
15
|
import LayoutProviders from '@theme/LayoutProviders';
|
|
16
|
-
import LayoutHead from '@theme/LayoutHead';
|
|
17
16
|
import type {Props} from '@theme/Layout';
|
|
18
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
PageMetadata,
|
|
19
|
+
ThemeClassNames,
|
|
20
|
+
useKeyboardNavigation,
|
|
21
|
+
} from '@docusaurus/theme-common';
|
|
19
22
|
import ErrorPageContent from '@theme/ErrorPageContent';
|
|
20
23
|
import './styles.css';
|
|
21
24
|
|
|
22
25
|
export default function Layout(props: Props): JSX.Element {
|
|
23
|
-
const {
|
|
26
|
+
const {
|
|
27
|
+
children,
|
|
28
|
+
noFooter,
|
|
29
|
+
wrapperClassName,
|
|
30
|
+
// not really layout-related, but kept for convenience/retro-compatibility
|
|
31
|
+
title,
|
|
32
|
+
description,
|
|
33
|
+
} = props;
|
|
24
34
|
|
|
25
35
|
useKeyboardNavigation();
|
|
26
36
|
|
|
27
37
|
return (
|
|
28
38
|
<LayoutProviders>
|
|
29
|
-
<
|
|
39
|
+
<PageMetadata title={title} description={description} />
|
|
30
40
|
|
|
31
41
|
<SkipToContent />
|
|
32
42
|
|
|
@@ -34,12 +44,7 @@ export default function Layout(props: Props): JSX.Element {
|
|
|
34
44
|
|
|
35
45
|
<Navbar />
|
|
36
46
|
|
|
37
|
-
<div
|
|
38
|
-
className={clsx(
|
|
39
|
-
ThemeClassNames.wrapper.main,
|
|
40
|
-
wrapperClassName,
|
|
41
|
-
pageClassName,
|
|
42
|
-
)}>
|
|
47
|
+
<div className={clsx(ThemeClassNames.wrapper.main, wrapperClassName)}>
|
|
43
48
|
<ErrorBoundary fallback={ErrorPageContent}>{children}</ErrorBoundary>
|
|
44
49
|
</div>
|
|
45
50
|
|
|
@@ -11,43 +11,49 @@ import Layout from '@theme/Layout';
|
|
|
11
11
|
import MDXContent from '@theme/MDXContent';
|
|
12
12
|
import type {Props} from '@theme/MDXPage';
|
|
13
13
|
import TOC from '@theme/TOC';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
PageMetadata,
|
|
16
|
+
HtmlClassNameProvider,
|
|
17
|
+
ThemeClassNames,
|
|
18
|
+
} from '@docusaurus/theme-common';
|
|
15
19
|
|
|
16
20
|
import styles from './styles.module.css';
|
|
17
21
|
|
|
18
22
|
export default function MDXPage(props: Props): JSX.Element {
|
|
19
23
|
const {content: MDXPageContent} = props;
|
|
20
24
|
const {
|
|
21
|
-
metadata: {title, description,
|
|
25
|
+
metadata: {title, description, frontMatter},
|
|
22
26
|
} = MDXPageContent;
|
|
23
27
|
const {wrapperClassName, hide_table_of_contents: hideTableOfContents} =
|
|
24
28
|
frontMatter;
|
|
25
29
|
|
|
26
30
|
return (
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<
|
|
34
|
-
<
|
|
35
|
-
<div className={clsx('
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{!hideTableOfContents && MDXPageContent.toc && (
|
|
41
|
-
<div className="col col--2">
|
|
42
|
-
<TOC
|
|
43
|
-
toc={MDXPageContent.toc}
|
|
44
|
-
minHeadingLevel={frontMatter.toc_min_heading_level}
|
|
45
|
-
maxHeadingLevel={frontMatter.toc_max_heading_level}
|
|
46
|
-
/>
|
|
31
|
+
<HtmlClassNameProvider
|
|
32
|
+
className={clsx(
|
|
33
|
+
wrapperClassName ?? ThemeClassNames.wrapper.mdxPages,
|
|
34
|
+
ThemeClassNames.page.mdxPage,
|
|
35
|
+
)}>
|
|
36
|
+
<PageMetadata title={title} description={description} />
|
|
37
|
+
<Layout>
|
|
38
|
+
<main className="container container--fluid margin-vert--lg">
|
|
39
|
+
<div className={clsx('row', styles.mdxPageWrapper)}>
|
|
40
|
+
<div className={clsx('col', !hideTableOfContents && 'col--8')}>
|
|
41
|
+
<MDXContent>
|
|
42
|
+
<MDXPageContent />
|
|
43
|
+
</MDXContent>
|
|
47
44
|
</div>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
{!hideTableOfContents && MDXPageContent.toc && (
|
|
46
|
+
<div className="col col--2">
|
|
47
|
+
<TOC
|
|
48
|
+
toc={MDXPageContent.toc}
|
|
49
|
+
minHeadingLevel={frontMatter.toc_min_heading_level}
|
|
50
|
+
maxHeadingLevel={frontMatter.toc_max_heading_level}
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
</main>
|
|
56
|
+
</Layout>
|
|
57
|
+
</HtmlClassNameProvider>
|
|
52
58
|
);
|
|
53
59
|
}
|
package/src/theme/NotFound.tsx
CHANGED
|
@@ -8,42 +8,47 @@
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import Layout from '@theme/Layout';
|
|
10
10
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
11
|
+
import {PageMetadata} from '@docusaurus/theme-common';
|
|
11
12
|
|
|
12
13
|
export default function NotFound(): JSX.Element {
|
|
13
14
|
return (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
15
|
+
<>
|
|
16
|
+
<PageMetadata
|
|
17
|
+
title={translate({
|
|
18
|
+
id: 'theme.NotFound.title',
|
|
19
|
+
message: 'Page Not Found',
|
|
20
|
+
})}
|
|
21
|
+
/>
|
|
22
|
+
<Layout>
|
|
23
|
+
<main className="container margin-vert--xl">
|
|
24
|
+
<div className="row">
|
|
25
|
+
<div className="col col--6 col--offset-3">
|
|
26
|
+
<h1 className="hero__title">
|
|
27
|
+
<Translate
|
|
28
|
+
id="theme.NotFound.title"
|
|
29
|
+
description="The title of the 404 page">
|
|
30
|
+
Page Not Found
|
|
31
|
+
</Translate>
|
|
32
|
+
</h1>
|
|
33
|
+
<p>
|
|
34
|
+
<Translate
|
|
35
|
+
id="theme.NotFound.p1"
|
|
36
|
+
description="The first paragraph of the 404 page">
|
|
37
|
+
We could not find what you were looking for.
|
|
38
|
+
</Translate>
|
|
39
|
+
</p>
|
|
40
|
+
<p>
|
|
41
|
+
<Translate
|
|
42
|
+
id="theme.NotFound.p2"
|
|
43
|
+
description="The 2nd paragraph of the 404 page">
|
|
44
|
+
Please contact the owner of the site that linked you to the
|
|
45
|
+
original URL and let them know their link is broken.
|
|
46
|
+
</Translate>
|
|
47
|
+
</p>
|
|
48
|
+
</div>
|
|
44
49
|
</div>
|
|
45
|
-
</
|
|
46
|
-
</
|
|
47
|
-
|
|
50
|
+
</main>
|
|
51
|
+
</Layout>
|
|
52
|
+
</>
|
|
48
53
|
);
|
|
49
54
|
}
|
|
@@ -9,19 +9,18 @@ import React from 'react';
|
|
|
9
9
|
import Head from '@docusaurus/Head';
|
|
10
10
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
11
11
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
12
|
-
import type {Props} from '@theme/Layout';
|
|
13
12
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
14
|
-
import Seo from '@theme/Seo';
|
|
15
13
|
import {
|
|
14
|
+
PageMetadata,
|
|
16
15
|
DEFAULT_SEARCH_TAG,
|
|
17
|
-
useTitleFormatter,
|
|
18
16
|
useAlternatePageUtils,
|
|
19
17
|
useThemeConfig,
|
|
20
18
|
keyboardFocusedClassName,
|
|
21
19
|
} from '@docusaurus/theme-common';
|
|
22
20
|
import {useLocation} from '@docusaurus/router';
|
|
23
21
|
|
|
24
|
-
//
|
|
22
|
+
// TODO move to SiteMetadataDefaults or theme-common ?
|
|
23
|
+
// Useful for i18n/SEO
|
|
25
24
|
// See https://developers.google.com/search/docs/advanced/crawling/localized-versions
|
|
26
25
|
// See https://github.com/facebook/docusaurus/issues/3317
|
|
27
26
|
function AlternateLangHeaders(): JSX.Element {
|
|
@@ -66,6 +65,7 @@ function useDefaultCanonicalUrl() {
|
|
|
66
65
|
return siteUrl + useBaseUrl(pathname);
|
|
67
66
|
}
|
|
68
67
|
|
|
68
|
+
// TODO move to SiteMetadataDefaults or theme-common ?
|
|
69
69
|
function CanonicalUrlHeaders({permalink}: {permalink?: string}) {
|
|
70
70
|
const {
|
|
71
71
|
siteConfig: {url: siteUrl},
|
|
@@ -83,45 +83,31 @@ function CanonicalUrlHeaders({permalink}: {permalink?: string}) {
|
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
export default function
|
|
86
|
+
export default function SiteMetadata(): JSX.Element {
|
|
87
87
|
const {
|
|
88
|
-
|
|
89
|
-
i18n: {currentLocale, localeConfigs},
|
|
88
|
+
i18n: {currentLocale},
|
|
90
89
|
} = useDocusaurusContext();
|
|
90
|
+
|
|
91
|
+
// TODO maybe move these 2 themeConfig to siteConfig?
|
|
92
|
+
// These seems useful for other themes as well
|
|
91
93
|
const {metadata, image: defaultImage} = useThemeConfig();
|
|
92
|
-
const {title, description, image, keywords, searchMetadata} = props;
|
|
93
|
-
const faviconUrl = useBaseUrl(favicon);
|
|
94
|
-
const pageTitle = useTitleFormatter(title);
|
|
95
|
-
const {htmlLang, direction: htmlDir} = localeConfigs[currentLocale]!;
|
|
96
94
|
|
|
97
95
|
return (
|
|
98
96
|
<>
|
|
99
97
|
<Head>
|
|
100
|
-
<html lang={htmlLang} dir={htmlDir} />
|
|
101
|
-
{favicon && <link rel="icon" href={faviconUrl} />}
|
|
102
|
-
<title>{pageTitle}</title>
|
|
103
|
-
<meta property="og:title" content={pageTitle} />
|
|
104
98
|
<meta name="twitter:card" content="summary_large_image" />
|
|
105
99
|
{/* The keyboard focus class name need to be applied when SSR so links
|
|
106
100
|
are outlined when JS is disabled */}
|
|
107
101
|
<body className={keyboardFocusedClassName} />
|
|
108
102
|
</Head>
|
|
109
103
|
|
|
110
|
-
{
|
|
111
|
-
{defaultImage && <Seo image={defaultImage} />}
|
|
112
|
-
{image && <Seo image={image} />}
|
|
113
|
-
|
|
114
|
-
<Seo description={description} keywords={keywords} />
|
|
104
|
+
{defaultImage && <PageMetadata image={defaultImage} />}
|
|
115
105
|
|
|
116
106
|
<CanonicalUrlHeaders />
|
|
117
107
|
|
|
118
108
|
<AlternateLangHeaders />
|
|
119
109
|
|
|
120
|
-
<SearchMetadata
|
|
121
|
-
tag={DEFAULT_SEARCH_TAG}
|
|
122
|
-
locale={currentLocale}
|
|
123
|
-
{...searchMetadata}
|
|
124
|
-
/>
|
|
110
|
+
<SearchMetadata tag={DEFAULT_SEARCH_TAG} locale={currentLocale} />
|
|
125
111
|
|
|
126
112
|
<Head
|
|
127
113
|
// it's important to have an additional <Head> element here,
|