@docusaurus/theme-classic 0.0.0-4178 → 0.0.0-4179
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/BlogListPage/index.js +1 -1
- package/lib/theme/BlogTagsListPage/index.js +1 -1
- package/lib/theme/BlogTagsPostsPage/index.js +1 -1
- package/lib/theme/DocPage/index.js +1 -1
- package/lib/theme/DocTagDocListPage/index.js +1 -1
- package/lib/theme/DocTagsListPage/index.js +1 -1
- package/lib/theme/LayoutHead/index.js +9 -6
- package/lib/theme/{SearchMetadatas → SearchMetadata}/index.js +2 -2
- package/lib/types.d.ts +4 -4
- package/lib/validateThemeConfig.js +6 -3
- package/lib-next/theme/BlogListPage/index.js +1 -1
- package/lib-next/theme/BlogTagsListPage/index.js +1 -1
- package/lib-next/theme/BlogTagsPostsPage/index.js +1 -1
- package/lib-next/theme/DocPage/index.js +1 -1
- package/lib-next/theme/DocTagDocListPage/index.js +1 -1
- package/lib-next/theme/DocTagsListPage/index.js +1 -1
- package/lib-next/theme/LayoutHead/index.js +9 -8
- package/lib-next/theme/{SearchMetadatas → SearchMetadata}/index.js +1 -1
- package/lib-next/types.d.ts +4 -4
- package/lib-next/validateThemeConfig.js +8 -5
- package/package.json +12 -12
- package/src/theme/BlogListPage/index.tsx +1 -1
- package/src/theme/BlogTagsListPage/index.tsx +1 -1
- package/src/theme/BlogTagsPostsPage/index.tsx +1 -1
- package/src/theme/DocPage/index.tsx +1 -1
- package/src/theme/DocTagDocListPage/index.tsx +1 -1
- package/src/theme/DocTagsListPage/index.tsx +1 -1
- package/src/theme/LayoutHead/index.tsx +9 -8
- package/src/theme/{SearchMetadatas → SearchMetadata}/index.tsx +2 -2
- package/src/types.d.ts +4 -4
- package/src/validateThemeConfig.ts +8 -5
|
@@ -43,7 +43,7 @@ function BlogListPage(props) {
|
|
|
43
43
|
} = metadata;
|
|
44
44
|
const isBlogOnlyMode = permalink === '/';
|
|
45
45
|
const title = isBlogOnlyMode ? siteTitle : blogTitle;
|
|
46
|
-
return <_BlogLayout.default title={title} description={blogDescription} wrapperClassName={_themeCommon.ThemeClassNames.wrapper.blogPages} pageClassName={_themeCommon.ThemeClassNames.page.blogListPage}
|
|
46
|
+
return <_BlogLayout.default title={title} description={blogDescription} wrapperClassName={_themeCommon.ThemeClassNames.wrapper.blogPages} pageClassName={_themeCommon.ThemeClassNames.page.blogListPage} searchMetadata={{
|
|
47
47
|
// assign unique search tag to exclude this page from search results!
|
|
48
48
|
tag: 'blog_posts_list'
|
|
49
49
|
}} sidebar={sidebar}>
|
|
@@ -27,7 +27,7 @@ function BlogTagsListPage(props) {
|
|
|
27
27
|
sidebar
|
|
28
28
|
} = props;
|
|
29
29
|
const title = (0, _themeCommon.translateTagsPageTitle)();
|
|
30
|
-
return <_BlogLayout.default title={title} wrapperClassName={_themeCommon.ThemeClassNames.wrapper.blogPages} pageClassName={_themeCommon.ThemeClassNames.page.blogTagsListPage}
|
|
30
|
+
return <_BlogLayout.default title={title} wrapperClassName={_themeCommon.ThemeClassNames.wrapper.blogPages} pageClassName={_themeCommon.ThemeClassNames.page.blogTagsListPage} searchMetadata={{
|
|
31
31
|
// assign unique search tag to exclude this page from search results!
|
|
32
32
|
tag: 'blog_tags_list'
|
|
33
33
|
}} sidebar={sidebar}>
|
|
@@ -63,7 +63,7 @@ function BlogTagsPostsPage(props) {
|
|
|
63
63
|
nPosts: blogPostsPlural(count),
|
|
64
64
|
tagName
|
|
65
65
|
});
|
|
66
|
-
return <_BlogLayout.default title={title} wrapperClassName={_themeCommon.ThemeClassNames.wrapper.blogPages} pageClassName={_themeCommon.ThemeClassNames.page.blogTagPostListPage}
|
|
66
|
+
return <_BlogLayout.default title={title} wrapperClassName={_themeCommon.ThemeClassNames.wrapper.blogPages} pageClassName={_themeCommon.ThemeClassNames.page.blogTagPostListPage} searchMetadata={{
|
|
67
67
|
// assign unique search tag to exclude this page from search results!
|
|
68
68
|
tag: 'blog_tags_posts'
|
|
69
69
|
}} sidebar={sidebar}>
|
|
@@ -67,7 +67,7 @@ function DocPageContent({
|
|
|
67
67
|
|
|
68
68
|
setHiddenSidebarContainer(value => !value);
|
|
69
69
|
}, [hiddenSidebar]);
|
|
70
|
-
return <_Layout.default wrapperClassName={_themeCommon.ThemeClassNames.wrapper.docsPages} pageClassName={_themeCommon.ThemeClassNames.page.docsDocPage}
|
|
70
|
+
return <_Layout.default wrapperClassName={_themeCommon.ThemeClassNames.wrapper.docsPages} pageClassName={_themeCommon.ThemeClassNames.page.docsDocPage} searchMetadata={{
|
|
71
71
|
version,
|
|
72
72
|
tag: (0, _themeCommon.docVersionSearchTag)(pluginId, version)
|
|
73
73
|
}}>
|
|
@@ -64,7 +64,7 @@ function DocTagDocListPage({
|
|
|
64
64
|
nDocsTagged: nDocsTaggedPlural(tag.docs.length),
|
|
65
65
|
tagName: tag.name
|
|
66
66
|
});
|
|
67
|
-
return <_Layout.default title={title} wrapperClassName={_themeCommon.ThemeClassNames.wrapper.docsPages} pageClassName={_themeCommon.ThemeClassNames.page.docsTagDocListPage}
|
|
67
|
+
return <_Layout.default title={title} wrapperClassName={_themeCommon.ThemeClassNames.wrapper.docsPages} pageClassName={_themeCommon.ThemeClassNames.page.docsTagDocListPage} searchMetadata={{
|
|
68
68
|
// assign unique search tag to exclude this page from search results!
|
|
69
69
|
tag: 'doc_tag_doc_list'
|
|
70
70
|
}}>
|
|
@@ -25,7 +25,7 @@ function DocTagsListPage({
|
|
|
25
25
|
tags
|
|
26
26
|
}) {
|
|
27
27
|
const title = (0, _themeCommon.translateTagsPageTitle)();
|
|
28
|
-
return <_Layout.default title={title} wrapperClassName={_themeCommon.ThemeClassNames.wrapper.docsPages} pageClassName={_themeCommon.ThemeClassNames.page.docsTagsListPage}
|
|
28
|
+
return <_Layout.default title={title} wrapperClassName={_themeCommon.ThemeClassNames.wrapper.docsPages} pageClassName={_themeCommon.ThemeClassNames.page.docsTagsListPage} searchMetadata={{
|
|
29
29
|
// assign unique search tag to exclude this page from search results!
|
|
30
30
|
tag: 'doc_tags_list'
|
|
31
31
|
}}>
|
|
@@ -13,7 +13,7 @@ var _useDocusaurusContext = _interopRequireDefault(require("@docusaurus/useDocus
|
|
|
13
13
|
|
|
14
14
|
var _useBaseUrl = _interopRequireDefault(require("@docusaurus/useBaseUrl"));
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _SearchMetadata = _interopRequireDefault(require("@theme/SearchMetadata"));
|
|
17
17
|
|
|
18
18
|
var _Seo = _interopRequireDefault(require("@theme/Seo"));
|
|
19
19
|
|
|
@@ -94,7 +94,7 @@ function LayoutHead(props) {
|
|
|
94
94
|
}
|
|
95
95
|
} = (0, _useDocusaurusContext.default)();
|
|
96
96
|
const {
|
|
97
|
-
|
|
97
|
+
metadata,
|
|
98
98
|
image: defaultImage
|
|
99
99
|
} = (0, _themeCommon.useThemeConfig)();
|
|
100
100
|
const {
|
|
@@ -102,7 +102,7 @@ function LayoutHead(props) {
|
|
|
102
102
|
description,
|
|
103
103
|
image,
|
|
104
104
|
keywords,
|
|
105
|
-
|
|
105
|
+
searchMetadata
|
|
106
106
|
} = props;
|
|
107
107
|
const faviconUrl = (0, _useBaseUrl.default)(favicon);
|
|
108
108
|
const pageTitle = (0, _themeCommon.useTitleFormatter)(title); // See https://github.com/facebook/docusaurus/issues/3317#issuecomment-754661855
|
|
@@ -132,15 +132,18 @@ function LayoutHead(props) {
|
|
|
132
132
|
|
|
133
133
|
<AlternateLangHeaders />
|
|
134
134
|
|
|
135
|
-
<
|
|
135
|
+
<_SearchMetadata.default tag={_themeCommon.DEFAULT_SEARCH_TAG} locale={currentLocale} {...searchMetadata} />
|
|
136
136
|
|
|
137
137
|
<_Head.default // it's important to have an additional <Head> element here,
|
|
138
138
|
// as it allows react-helmet to override values set in previous <Head>
|
|
139
|
-
// ie we can override default
|
|
139
|
+
// ie we can override default metadata such as "twitter:card"
|
|
140
140
|
// In same Head, the same meta would appear twice instead of overriding
|
|
141
141
|
// See react-helmet doc
|
|
142
142
|
>
|
|
143
|
-
{
|
|
143
|
+
{
|
|
144
|
+
/* Yes, "metadatum" is the grammatically correct term */
|
|
145
|
+
}
|
|
146
|
+
{metadata.map((metadatum, i) => <meta key={`metadata_${i}`} {...metadatum} />)}
|
|
144
147
|
</_Head.default>
|
|
145
148
|
</>;
|
|
146
149
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = SearchMetadata;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
@@ -20,7 +20,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
20
20
|
// Note: we don't couple this to Algolia/DocSearch on purpose
|
|
21
21
|
// We may want to support other search engine plugins too
|
|
22
22
|
// Search plugins should swizzle/override this comp to add their behavior
|
|
23
|
-
function
|
|
23
|
+
function SearchMetadata({
|
|
24
24
|
locale,
|
|
25
25
|
version,
|
|
26
26
|
tag
|
package/lib/types.d.ts
CHANGED
|
@@ -301,7 +301,7 @@ declare module '@theme/Layout' {
|
|
|
301
301
|
readonly permalink?: string;
|
|
302
302
|
readonly wrapperClassName?: string;
|
|
303
303
|
readonly pageClassName?: string;
|
|
304
|
-
readonly
|
|
304
|
+
readonly searchMetadata?: {
|
|
305
305
|
readonly version?: string;
|
|
306
306
|
readonly tag?: string;
|
|
307
307
|
};
|
|
@@ -320,15 +320,15 @@ declare module '@theme/LayoutHead' {
|
|
|
320
320
|
export default LayoutHead;
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
-
declare module '@theme/
|
|
323
|
+
declare module '@theme/SearchMetadata' {
|
|
324
324
|
export interface Props {
|
|
325
325
|
readonly locale?: string;
|
|
326
326
|
readonly version?: string;
|
|
327
327
|
readonly tag?: string;
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
const
|
|
331
|
-
export default
|
|
330
|
+
const SearchMetadata: (props: Props) => JSX.Element;
|
|
331
|
+
export default SearchMetadata;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
declare module '@theme/LastUpdated' {
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.validateThemeConfig = validateThemeConfig;
|
|
7
|
-
exports.ThemeConfigSchema = void 0;
|
|
7
|
+
exports.ThemeConfigSchema = exports.DEFAULT_CONFIG = void 0;
|
|
8
8
|
|
|
9
9
|
var _utilsValidation = require("@docusaurus/utils-validation");
|
|
10
10
|
|
|
@@ -36,7 +36,7 @@ const DEFAULT_COLOR_MODE_CONFIG = {
|
|
|
36
36
|
const DEFAULT_CONFIG = {
|
|
37
37
|
colorMode: DEFAULT_COLOR_MODE_CONFIG,
|
|
38
38
|
docs: DEFAULT_DOCS_CONFIG,
|
|
39
|
-
|
|
39
|
+
metadata: [],
|
|
40
40
|
prism: {
|
|
41
41
|
additionalLanguages: []
|
|
42
42
|
},
|
|
@@ -218,7 +218,10 @@ const ThemeConfigSchema = _utilsValidation.Joi.object({
|
|
|
218
218
|
colorMode: ColorModeSchema,
|
|
219
219
|
image: _utilsValidation.Joi.string(),
|
|
220
220
|
docs: DocsSchema,
|
|
221
|
-
|
|
221
|
+
metadata: _utilsValidation.Joi.array().items(HtmlMetadataSchema).default(DEFAULT_CONFIG.metadata),
|
|
222
|
+
metadatas: _utilsValidation.Joi.any().forbidden().messages({
|
|
223
|
+
'any.unknown': 'themeConfig.metadatas has been renamed as themeConfig.metadata. See https://github.com/facebook/docusaurus/pull/5871'
|
|
224
|
+
}),
|
|
222
225
|
announcementBar: _utilsValidation.Joi.object({
|
|
223
226
|
id: _utilsValidation.Joi.string().default('announcement-bar'),
|
|
224
227
|
content: _utilsValidation.Joi.string().required(),
|
|
@@ -25,7 +25,7 @@ function BlogListPage(props) {
|
|
|
25
25
|
description={blogDescription}
|
|
26
26
|
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
|
27
27
|
pageClassName={ThemeClassNames.page.blogListPage}
|
|
28
|
-
|
|
28
|
+
searchMetadata={{
|
|
29
29
|
// assign unique search tag to exclude this page from search results!
|
|
30
30
|
tag: 'blog_posts_list',
|
|
31
31
|
}}
|
|
@@ -20,7 +20,7 @@ function BlogTagsListPage(props) {
|
|
|
20
20
|
title={title}
|
|
21
21
|
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
|
22
22
|
pageClassName={ThemeClassNames.page.blogTagsListPage}
|
|
23
|
-
|
|
23
|
+
searchMetadata={{
|
|
24
24
|
// assign unique search tag to exclude this page from search results!
|
|
25
25
|
tag: 'blog_tags_list',
|
|
26
26
|
}}
|
|
@@ -50,7 +50,7 @@ export default function BlogTagsPostsPage(props) {
|
|
|
50
50
|
title={title}
|
|
51
51
|
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
|
52
52
|
pageClassName={ThemeClassNames.page.blogTagPostListPage}
|
|
53
|
-
|
|
53
|
+
searchMetadata={{
|
|
54
54
|
// assign unique search tag to exclude this page from search results!
|
|
55
55
|
tag: 'blog_tags_posts',
|
|
56
56
|
}}
|
|
@@ -39,7 +39,7 @@ function DocPageContent({currentDocRoute, versionMetadata, children}) {
|
|
|
39
39
|
<Layout
|
|
40
40
|
wrapperClassName={ThemeClassNames.wrapper.docsPages}
|
|
41
41
|
pageClassName={ThemeClassNames.page.docsDocPage}
|
|
42
|
-
|
|
42
|
+
searchMetadata={{
|
|
43
43
|
version,
|
|
44
44
|
tag: docVersionSearchTag(pluginId, version),
|
|
45
45
|
}}>
|
|
@@ -59,7 +59,7 @@ export default function DocTagDocListPage({tag}) {
|
|
|
59
59
|
title={title}
|
|
60
60
|
wrapperClassName={ThemeClassNames.wrapper.docsPages}
|
|
61
61
|
pageClassName={ThemeClassNames.page.docsTagDocListPage}
|
|
62
|
-
|
|
62
|
+
searchMetadata={{
|
|
63
63
|
// assign unique search tag to exclude this page from search results!
|
|
64
64
|
tag: 'doc_tag_doc_list',
|
|
65
65
|
}}>
|
|
@@ -19,7 +19,7 @@ function DocTagsListPage({tags}) {
|
|
|
19
19
|
title={title}
|
|
20
20
|
wrapperClassName={ThemeClassNames.wrapper.docsPages}
|
|
21
21
|
pageClassName={ThemeClassNames.page.docsTagsListPage}
|
|
22
|
-
|
|
22
|
+
searchMetadata={{
|
|
23
23
|
// assign unique search tag to exclude this page from search results!
|
|
24
24
|
tag: 'doc_tags_list',
|
|
25
25
|
}}>
|
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
import Head from '@docusaurus/Head';
|
|
9
9
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
10
10
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
11
|
-
import
|
|
11
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
12
12
|
import Seo from '@theme/Seo';
|
|
13
13
|
import {
|
|
14
14
|
DEFAULT_SEARCH_TAG,
|
|
@@ -81,8 +81,8 @@ export default function LayoutHead(props) {
|
|
|
81
81
|
siteConfig: {favicon},
|
|
82
82
|
i18n: {currentLocale, localeConfigs},
|
|
83
83
|
} = useDocusaurusContext();
|
|
84
|
-
const {
|
|
85
|
-
const {title, description, image, keywords,
|
|
84
|
+
const {metadata, image: defaultImage} = useThemeConfig();
|
|
85
|
+
const {title, description, image, keywords, searchMetadata} = props;
|
|
86
86
|
const faviconUrl = useBaseUrl(favicon);
|
|
87
87
|
const pageTitle = useTitleFormatter(title); // See https://github.com/facebook/docusaurus/issues/3317#issuecomment-754661855
|
|
88
88
|
// const htmlLang = currentLocale.split('-')[0];
|
|
@@ -110,20 +110,21 @@ export default function LayoutHead(props) {
|
|
|
110
110
|
|
|
111
111
|
<AlternateLangHeaders />
|
|
112
112
|
|
|
113
|
-
<
|
|
113
|
+
<SearchMetadata
|
|
114
114
|
tag={DEFAULT_SEARCH_TAG}
|
|
115
115
|
locale={currentLocale}
|
|
116
|
-
{...
|
|
116
|
+
{...searchMetadata}
|
|
117
117
|
/>
|
|
118
118
|
|
|
119
119
|
<Head // it's important to have an additional <Head> element here,
|
|
120
120
|
// as it allows react-helmet to override values set in previous <Head>
|
|
121
|
-
// ie we can override default
|
|
121
|
+
// ie we can override default metadata such as "twitter:card"
|
|
122
122
|
// In same Head, the same meta would appear twice instead of overriding
|
|
123
123
|
// See react-helmet doc
|
|
124
124
|
>
|
|
125
|
-
{
|
|
126
|
-
|
|
125
|
+
{/* Yes, "metadatum" is the grammatically correct term */}
|
|
126
|
+
{metadata.map((metadatum, i) => (
|
|
127
|
+
<meta key={`metadata_${i}`} {...metadatum} />
|
|
127
128
|
))}
|
|
128
129
|
</Head>
|
|
129
130
|
</>
|
|
@@ -9,7 +9,7 @@ import Head from '@docusaurus/Head';
|
|
|
9
9
|
// Note: we don't couple this to Algolia/DocSearch on purpose
|
|
10
10
|
// We may want to support other search engine plugins too
|
|
11
11
|
// Search plugins should swizzle/override this comp to add their behavior
|
|
12
|
-
export default function
|
|
12
|
+
export default function SearchMetadata({locale, version, tag}) {
|
|
13
13
|
return (
|
|
14
14
|
<Head>
|
|
15
15
|
{locale && <meta name="docusaurus_locale" content={locale} />}
|
package/lib-next/types.d.ts
CHANGED
|
@@ -301,7 +301,7 @@ declare module '@theme/Layout' {
|
|
|
301
301
|
readonly permalink?: string;
|
|
302
302
|
readonly wrapperClassName?: string;
|
|
303
303
|
readonly pageClassName?: string;
|
|
304
|
-
readonly
|
|
304
|
+
readonly searchMetadata?: {
|
|
305
305
|
readonly version?: string;
|
|
306
306
|
readonly tag?: string;
|
|
307
307
|
};
|
|
@@ -320,15 +320,15 @@ declare module '@theme/LayoutHead' {
|
|
|
320
320
|
export default LayoutHead;
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
-
declare module '@theme/
|
|
323
|
+
declare module '@theme/SearchMetadata' {
|
|
324
324
|
export interface Props {
|
|
325
325
|
readonly locale?: string;
|
|
326
326
|
readonly version?: string;
|
|
327
327
|
readonly tag?: string;
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
const
|
|
331
|
-
export default
|
|
330
|
+
const SearchMetadata: (props: Props) => JSX.Element;
|
|
331
|
+
export default SearchMetadata;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
declare module '@theme/LastUpdated' {
|
|
@@ -27,7 +27,7 @@ const DEFAULT_COLOR_MODE_CONFIG = {
|
|
|
27
27
|
const DEFAULT_CONFIG = {
|
|
28
28
|
colorMode: DEFAULT_COLOR_MODE_CONFIG,
|
|
29
29
|
docs: DEFAULT_DOCS_CONFIG,
|
|
30
|
-
|
|
30
|
+
metadata: [],
|
|
31
31
|
prism: {
|
|
32
32
|
additionalLanguages: [],
|
|
33
33
|
},
|
|
@@ -41,7 +41,6 @@ const DEFAULT_CONFIG = {
|
|
|
41
41
|
maxHeadingLevel: 3,
|
|
42
42
|
},
|
|
43
43
|
};
|
|
44
|
-
exports.DEFAULT_CONFIG = DEFAULT_CONFIG;
|
|
45
44
|
const NavbarItemPosition = Joi.string().equal('left', 'right').default('left');
|
|
46
45
|
const NavbarItemBaseSchema = Joi.object({
|
|
47
46
|
label: Joi.string(),
|
|
@@ -242,9 +241,13 @@ const ThemeConfigSchema = Joi.object({
|
|
|
242
241
|
colorMode: ColorModeSchema,
|
|
243
242
|
image: Joi.string(),
|
|
244
243
|
docs: DocsSchema,
|
|
245
|
-
|
|
244
|
+
metadata: Joi.array()
|
|
246
245
|
.items(HtmlMetadataSchema)
|
|
247
|
-
.default(DEFAULT_CONFIG.
|
|
246
|
+
.default(DEFAULT_CONFIG.metadata),
|
|
247
|
+
metadatas: Joi.any().forbidden().messages({
|
|
248
|
+
'any.unknown':
|
|
249
|
+
'themeConfig.metadatas has been renamed as themeConfig.metadata. See https://github.com/facebook/docusaurus/pull/5871',
|
|
250
|
+
}),
|
|
248
251
|
announcementBar: Joi.object({
|
|
249
252
|
id: Joi.string().default('announcement-bar'),
|
|
250
253
|
content: Joi.string().required(),
|
|
@@ -335,7 +338,7 @@ const ThemeConfigSchema = Joi.object({
|
|
|
335
338
|
.default(DEFAULT_CONFIG.tableOfContents.maxHeadingLevel),
|
|
336
339
|
}).default(DEFAULT_CONFIG.tableOfContents),
|
|
337
340
|
});
|
|
338
|
-
export {ThemeConfigSchema};
|
|
341
|
+
export {DEFAULT_CONFIG, ThemeConfigSchema};
|
|
339
342
|
export function validateThemeConfig({validate, themeConfig}) {
|
|
340
343
|
return validate(ThemeConfigSchema, themeConfig);
|
|
341
344
|
}
|
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-4179",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/types.d.ts",
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"update-code-translations": "node -e 'require(\"./update-code-translations.js\").run()'"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@docusaurus/core": "0.0.0-
|
|
27
|
-
"@docusaurus/plugin-content-blog": "0.0.0-
|
|
28
|
-
"@docusaurus/plugin-content-docs": "0.0.0-
|
|
29
|
-
"@docusaurus/plugin-content-pages": "0.0.0-
|
|
30
|
-
"@docusaurus/theme-common": "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-
|
|
26
|
+
"@docusaurus/core": "0.0.0-4179",
|
|
27
|
+
"@docusaurus/plugin-content-blog": "0.0.0-4179",
|
|
28
|
+
"@docusaurus/plugin-content-docs": "0.0.0-4179",
|
|
29
|
+
"@docusaurus/plugin-content-pages": "0.0.0-4179",
|
|
30
|
+
"@docusaurus/theme-common": "0.0.0-4179",
|
|
31
|
+
"@docusaurus/types": "0.0.0-4179",
|
|
32
|
+
"@docusaurus/utils": "0.0.0-4179",
|
|
33
|
+
"@docusaurus/utils-common": "0.0.0-4179",
|
|
34
|
+
"@docusaurus/utils-validation": "0.0.0-4179",
|
|
35
35
|
"@mdx-js/mdx": "^1.6.21",
|
|
36
36
|
"@mdx-js/react": "^1.6.21",
|
|
37
37
|
"chalk": "^4.1.2",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"rtlcss": "^3.3.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
53
|
+
"@docusaurus/module-type-aliases": "0.0.0-4179",
|
|
54
54
|
"@types/mdx-js__react": "^1.5.4",
|
|
55
55
|
"@types/parse-numeric-range": "^0.0.1",
|
|
56
56
|
"@types/rtlcss": "^3.1.1",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"engines": {
|
|
65
65
|
"node": ">=14"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "d61c493d9799b974fb8987530448f46642451363"
|
|
68
68
|
}
|
|
@@ -29,7 +29,7 @@ function BlogListPage(props: Props): JSX.Element {
|
|
|
29
29
|
description={blogDescription}
|
|
30
30
|
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
|
31
31
|
pageClassName={ThemeClassNames.page.blogListPage}
|
|
32
|
-
|
|
32
|
+
searchMetadata={{
|
|
33
33
|
// assign unique search tag to exclude this page from search results!
|
|
34
34
|
tag: 'blog_posts_list',
|
|
35
35
|
}}
|
|
@@ -23,7 +23,7 @@ function BlogTagsListPage(props: Props): JSX.Element {
|
|
|
23
23
|
title={title}
|
|
24
24
|
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
|
25
25
|
pageClassName={ThemeClassNames.page.blogTagsListPage}
|
|
26
|
-
|
|
26
|
+
searchMetadata={{
|
|
27
27
|
// assign unique search tag to exclude this page from search results!
|
|
28
28
|
tag: 'blog_tags_list',
|
|
29
29
|
}}
|
|
@@ -50,7 +50,7 @@ export default function BlogTagsPostsPage(props: Props): JSX.Element {
|
|
|
50
50
|
title={title}
|
|
51
51
|
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
|
52
52
|
pageClassName={ThemeClassNames.page.blogTagPostListPage}
|
|
53
|
-
|
|
53
|
+
searchMetadata={{
|
|
54
54
|
// assign unique search tag to exclude this page from search results!
|
|
55
55
|
tag: 'blog_tags_posts',
|
|
56
56
|
}}
|
|
@@ -59,7 +59,7 @@ export default function DocTagDocListPage({tag}: Props): JSX.Element {
|
|
|
59
59
|
title={title}
|
|
60
60
|
wrapperClassName={ThemeClassNames.wrapper.docsPages}
|
|
61
61
|
pageClassName={ThemeClassNames.page.docsTagDocListPage}
|
|
62
|
-
|
|
62
|
+
searchMetadata={{
|
|
63
63
|
// assign unique search tag to exclude this page from search results!
|
|
64
64
|
tag: 'doc_tag_doc_list',
|
|
65
65
|
}}>
|
|
@@ -22,7 +22,7 @@ function DocTagsListPage({tags}: Props): JSX.Element {
|
|
|
22
22
|
title={title}
|
|
23
23
|
wrapperClassName={ThemeClassNames.wrapper.docsPages}
|
|
24
24
|
pageClassName={ThemeClassNames.page.docsTagsListPage}
|
|
25
|
-
|
|
25
|
+
searchMetadata={{
|
|
26
26
|
// assign unique search tag to exclude this page from search results!
|
|
27
27
|
tag: 'doc_tags_list',
|
|
28
28
|
}}>
|
|
@@ -10,7 +10,7 @@ import Head from '@docusaurus/Head';
|
|
|
10
10
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
11
11
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
12
12
|
import type {Props} from '@theme/Layout';
|
|
13
|
-
import
|
|
13
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
14
14
|
import Seo from '@theme/Seo';
|
|
15
15
|
import {
|
|
16
16
|
DEFAULT_SEARCH_TAG,
|
|
@@ -87,8 +87,8 @@ export default function LayoutHead(props: Props): JSX.Element {
|
|
|
87
87
|
siteConfig: {favicon},
|
|
88
88
|
i18n: {currentLocale, localeConfigs},
|
|
89
89
|
} = useDocusaurusContext();
|
|
90
|
-
const {
|
|
91
|
-
const {title, description, image, keywords,
|
|
90
|
+
const {metadata, image: defaultImage} = useThemeConfig();
|
|
91
|
+
const {title, description, image, keywords, searchMetadata} = props;
|
|
92
92
|
const faviconUrl = useBaseUrl(favicon);
|
|
93
93
|
const pageTitle = useTitleFormatter(title);
|
|
94
94
|
|
|
@@ -117,21 +117,22 @@ export default function LayoutHead(props: Props): JSX.Element {
|
|
|
117
117
|
|
|
118
118
|
<AlternateLangHeaders />
|
|
119
119
|
|
|
120
|
-
<
|
|
120
|
+
<SearchMetadata
|
|
121
121
|
tag={DEFAULT_SEARCH_TAG}
|
|
122
122
|
locale={currentLocale}
|
|
123
|
-
{...
|
|
123
|
+
{...searchMetadata}
|
|
124
124
|
/>
|
|
125
125
|
|
|
126
126
|
<Head
|
|
127
127
|
// it's important to have an additional <Head> element here,
|
|
128
128
|
// as it allows react-helmet to override values set in previous <Head>
|
|
129
|
-
// ie we can override default
|
|
129
|
+
// ie we can override default metadata such as "twitter:card"
|
|
130
130
|
// In same Head, the same meta would appear twice instead of overriding
|
|
131
131
|
// See react-helmet doc
|
|
132
132
|
>
|
|
133
|
-
{
|
|
134
|
-
|
|
133
|
+
{/* Yes, "metadatum" is the grammatically correct term */}
|
|
134
|
+
{metadata.map((metadatum, i) => (
|
|
135
|
+
<meta key={`metadata_${i}`} {...metadatum} />
|
|
135
136
|
))}
|
|
136
137
|
</Head>
|
|
137
138
|
</>
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
10
|
import Head from '@docusaurus/Head';
|
|
11
|
-
import type {Props} from '@theme/
|
|
11
|
+
import type {Props} from '@theme/SearchMetadata';
|
|
12
12
|
|
|
13
13
|
// Note: we don't couple this to Algolia/DocSearch on purpose
|
|
14
14
|
// We may want to support other search engine plugins too
|
|
15
15
|
// Search plugins should swizzle/override this comp to add their behavior
|
|
16
|
-
export default function
|
|
16
|
+
export default function SearchMetadata({
|
|
17
17
|
locale,
|
|
18
18
|
version,
|
|
19
19
|
tag,
|
package/src/types.d.ts
CHANGED
|
@@ -301,7 +301,7 @@ declare module '@theme/Layout' {
|
|
|
301
301
|
readonly permalink?: string;
|
|
302
302
|
readonly wrapperClassName?: string;
|
|
303
303
|
readonly pageClassName?: string;
|
|
304
|
-
readonly
|
|
304
|
+
readonly searchMetadata?: {
|
|
305
305
|
readonly version?: string;
|
|
306
306
|
readonly tag?: string;
|
|
307
307
|
};
|
|
@@ -320,15 +320,15 @@ declare module '@theme/LayoutHead' {
|
|
|
320
320
|
export default LayoutHead;
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
-
declare module '@theme/
|
|
323
|
+
declare module '@theme/SearchMetadata' {
|
|
324
324
|
export interface Props {
|
|
325
325
|
readonly locale?: string;
|
|
326
326
|
readonly version?: string;
|
|
327
327
|
readonly tag?: string;
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
const
|
|
331
|
-
export default
|
|
330
|
+
const SearchMetadata: (props: Props) => JSX.Element;
|
|
331
|
+
export default SearchMetadata;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
declare module '@theme/LastUpdated' {
|
|
@@ -32,7 +32,7 @@ const DEFAULT_COLOR_MODE_CONFIG = {
|
|
|
32
32
|
const DEFAULT_CONFIG = {
|
|
33
33
|
colorMode: DEFAULT_COLOR_MODE_CONFIG,
|
|
34
34
|
docs: DEFAULT_DOCS_CONFIG,
|
|
35
|
-
|
|
35
|
+
metadata: [],
|
|
36
36
|
prism: {
|
|
37
37
|
additionalLanguages: [],
|
|
38
38
|
},
|
|
@@ -46,7 +46,6 @@ const DEFAULT_CONFIG = {
|
|
|
46
46
|
maxHeadingLevel: 3,
|
|
47
47
|
},
|
|
48
48
|
};
|
|
49
|
-
exports.DEFAULT_CONFIG = DEFAULT_CONFIG;
|
|
50
49
|
|
|
51
50
|
const NavbarItemPosition = Joi.string().equal('left', 'right').default('left');
|
|
52
51
|
|
|
@@ -264,9 +263,13 @@ const ThemeConfigSchema = Joi.object({
|
|
|
264
263
|
colorMode: ColorModeSchema,
|
|
265
264
|
image: Joi.string(),
|
|
266
265
|
docs: DocsSchema,
|
|
267
|
-
|
|
266
|
+
metadata: Joi.array()
|
|
268
267
|
.items(HtmlMetadataSchema)
|
|
269
|
-
.default(DEFAULT_CONFIG.
|
|
268
|
+
.default(DEFAULT_CONFIG.metadata),
|
|
269
|
+
metadatas: Joi.any().forbidden().messages({
|
|
270
|
+
'any.unknown':
|
|
271
|
+
'themeConfig.metadatas has been renamed as themeConfig.metadata. See https://github.com/facebook/docusaurus/pull/5871',
|
|
272
|
+
}),
|
|
270
273
|
announcementBar: Joi.object({
|
|
271
274
|
id: Joi.string().default('announcement-bar'),
|
|
272
275
|
content: Joi.string().required(),
|
|
@@ -358,7 +361,7 @@ const ThemeConfigSchema = Joi.object({
|
|
|
358
361
|
}).default(DEFAULT_CONFIG.tableOfContents),
|
|
359
362
|
});
|
|
360
363
|
|
|
361
|
-
export {ThemeConfigSchema};
|
|
364
|
+
export {DEFAULT_CONFIG, ThemeConfigSchema};
|
|
362
365
|
|
|
363
366
|
export function validateThemeConfig({
|
|
364
367
|
validate,
|