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