mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-05 04:12:53 +02:00
misc: replace all "Metadatas" with "Metadata" (#5871)
Co-authored-by: Josh-Cena <sidachen2003@gmail.com>
This commit is contained in:
parent
eab8c7c010
commit
c541e2d83c
36 changed files with 107 additions and 106 deletions
|
@ -29,7 +29,7 @@ function BlogListPage(props: Props): JSX.Element {
|
|||
description={blogDescription}
|
||||
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
||||
pageClassName={ThemeClassNames.page.blogListPage}
|
||||
searchMetadatas={{
|
||||
searchMetadata={{
|
||||
// assign unique search tag to exclude this page from search results!
|
||||
tag: 'blog_posts_list',
|
||||
}}
|
||||
|
|
|
@ -23,7 +23,7 @@ function BlogTagsListPage(props: Props): JSX.Element {
|
|||
title={title}
|
||||
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
||||
pageClassName={ThemeClassNames.page.blogTagsListPage}
|
||||
searchMetadatas={{
|
||||
searchMetadata={{
|
||||
// assign unique search tag to exclude this page from search results!
|
||||
tag: 'blog_tags_list',
|
||||
}}
|
||||
|
|
|
@ -50,7 +50,7 @@ export default function BlogTagsPostsPage(props: Props): JSX.Element {
|
|||
title={title}
|
||||
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
||||
pageClassName={ThemeClassNames.page.blogTagPostListPage}
|
||||
searchMetadatas={{
|
||||
searchMetadata={{
|
||||
// assign unique search tag to exclude this page from search results!
|
||||
tag: 'blog_tags_posts',
|
||||
}}
|
||||
|
|
|
@ -58,7 +58,7 @@ function DocPageContent({
|
|||
<Layout
|
||||
wrapperClassName={ThemeClassNames.wrapper.docsPages}
|
||||
pageClassName={ThemeClassNames.page.docsDocPage}
|
||||
searchMetadatas={{
|
||||
searchMetadata={{
|
||||
version,
|
||||
tag: docVersionSearchTag(pluginId, version),
|
||||
}}>
|
||||
|
|
|
@ -59,7 +59,7 @@ export default function DocTagDocListPage({tag}: Props): JSX.Element {
|
|||
title={title}
|
||||
wrapperClassName={ThemeClassNames.wrapper.docsPages}
|
||||
pageClassName={ThemeClassNames.page.docsTagDocListPage}
|
||||
searchMetadatas={{
|
||||
searchMetadata={{
|
||||
// assign unique search tag to exclude this page from search results!
|
||||
tag: 'doc_tag_doc_list',
|
||||
}}>
|
||||
|
|
|
@ -22,7 +22,7 @@ function DocTagsListPage({tags}: Props): JSX.Element {
|
|||
title={title}
|
||||
wrapperClassName={ThemeClassNames.wrapper.docsPages}
|
||||
pageClassName={ThemeClassNames.page.docsTagsListPage}
|
||||
searchMetadatas={{
|
||||
searchMetadata={{
|
||||
// assign unique search tag to exclude this page from search results!
|
||||
tag: 'doc_tags_list',
|
||||
}}>
|
||||
|
|
|
@ -10,7 +10,7 @@ import Head from '@docusaurus/Head';
|
|||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import useBaseUrl from '@docusaurus/useBaseUrl';
|
||||
import type {Props} from '@theme/Layout';
|
||||
import SearchMetadatas from '@theme/SearchMetadatas';
|
||||
import SearchMetadata from '@theme/SearchMetadata';
|
||||
import Seo from '@theme/Seo';
|
||||
import {
|
||||
DEFAULT_SEARCH_TAG,
|
||||
|
@ -87,8 +87,8 @@ export default function LayoutHead(props: Props): JSX.Element {
|
|||
siteConfig: {favicon},
|
||||
i18n: {currentLocale, localeConfigs},
|
||||
} = useDocusaurusContext();
|
||||
const {metadatas, image: defaultImage} = useThemeConfig();
|
||||
const {title, description, image, keywords, searchMetadatas} = props;
|
||||
const {metadata, image: defaultImage} = useThemeConfig();
|
||||
const {title, description, image, keywords, searchMetadata} = props;
|
||||
const faviconUrl = useBaseUrl(favicon);
|
||||
const pageTitle = useTitleFormatter(title);
|
||||
|
||||
|
@ -117,21 +117,22 @@ export default function LayoutHead(props: Props): JSX.Element {
|
|||
|
||||
<AlternateLangHeaders />
|
||||
|
||||
<SearchMetadatas
|
||||
<SearchMetadata
|
||||
tag={DEFAULT_SEARCH_TAG}
|
||||
locale={currentLocale}
|
||||
{...searchMetadatas}
|
||||
{...searchMetadata}
|
||||
/>
|
||||
|
||||
<Head
|
||||
// it's important to have an additional <Head> element here,
|
||||
// as it allows react-helmet to override values set in previous <Head>
|
||||
// ie we can override default metadatas such as "twitter:card"
|
||||
// ie we can override default metadata such as "twitter:card"
|
||||
// In same Head, the same meta would appear twice instead of overriding
|
||||
// See react-helmet doc
|
||||
>
|
||||
{metadatas.map((metadata, i) => (
|
||||
<meta key={`metadata_${i}`} {...metadata} />
|
||||
{/* Yes, "metadatum" is the grammatically correct term */}
|
||||
{metadata.map((metadatum, i) => (
|
||||
<meta key={`metadata_${i}`} {...metadatum} />
|
||||
))}
|
||||
</Head>
|
||||
</>
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
import React from 'react';
|
||||
|
||||
import Head from '@docusaurus/Head';
|
||||
import type {Props} from '@theme/SearchMetadatas';
|
||||
import type {Props} from '@theme/SearchMetadata';
|
||||
|
||||
// Note: we don't couple this to Algolia/DocSearch on purpose
|
||||
// We may want to support other search engine plugins too
|
||||
// Search plugins should swizzle/override this comp to add their behavior
|
||||
export default function SearchMetadatas({
|
||||
export default function SearchMetadata({
|
||||
locale,
|
||||
version,
|
||||
tag,
|
|
@ -301,7 +301,7 @@ declare module '@theme/Layout' {
|
|||
readonly permalink?: string;
|
||||
readonly wrapperClassName?: string;
|
||||
readonly pageClassName?: string;
|
||||
readonly searchMetadatas?: {
|
||||
readonly searchMetadata?: {
|
||||
readonly version?: string;
|
||||
readonly tag?: string;
|
||||
};
|
||||
|
@ -320,15 +320,15 @@ declare module '@theme/LayoutHead' {
|
|||
export default LayoutHead;
|
||||
}
|
||||
|
||||
declare module '@theme/SearchMetadatas' {
|
||||
declare module '@theme/SearchMetadata' {
|
||||
export interface Props {
|
||||
readonly locale?: string;
|
||||
readonly version?: string;
|
||||
readonly tag?: string;
|
||||
}
|
||||
|
||||
const SearchMetadatas: (props: Props) => JSX.Element;
|
||||
export default SearchMetadatas;
|
||||
const SearchMetadata: (props: Props) => JSX.Element;
|
||||
export default SearchMetadata;
|
||||
}
|
||||
|
||||
declare module '@theme/LastUpdated' {
|
||||
|
|
|
@ -32,7 +32,7 @@ const DEFAULT_COLOR_MODE_CONFIG = {
|
|||
const DEFAULT_CONFIG = {
|
||||
colorMode: DEFAULT_COLOR_MODE_CONFIG,
|
||||
docs: DEFAULT_DOCS_CONFIG,
|
||||
metadatas: [],
|
||||
metadata: [],
|
||||
prism: {
|
||||
additionalLanguages: [],
|
||||
},
|
||||
|
@ -46,7 +46,6 @@ const DEFAULT_CONFIG = {
|
|||
maxHeadingLevel: 3,
|
||||
},
|
||||
};
|
||||
exports.DEFAULT_CONFIG = DEFAULT_CONFIG;
|
||||
|
||||
const NavbarItemPosition = Joi.string().equal('left', 'right').default('left');
|
||||
|
||||
|
@ -264,9 +263,13 @@ const ThemeConfigSchema = Joi.object({
|
|||
colorMode: ColorModeSchema,
|
||||
image: Joi.string(),
|
||||
docs: DocsSchema,
|
||||
metadatas: Joi.array()
|
||||
metadata: Joi.array()
|
||||
.items(HtmlMetadataSchema)
|
||||
.default(DEFAULT_CONFIG.metadatas),
|
||||
.default(DEFAULT_CONFIG.metadata),
|
||||
metadatas: Joi.any().forbidden().messages({
|
||||
'any.unknown':
|
||||
'themeConfig.metadatas has been renamed as themeConfig.metadata. See https://github.com/facebook/docusaurus/pull/5871',
|
||||
}),
|
||||
announcementBar: Joi.object({
|
||||
id: Joi.string().default('announcement-bar'),
|
||||
content: Joi.string().required(),
|
||||
|
@ -358,7 +361,7 @@ const ThemeConfigSchema = Joi.object({
|
|||
}).default(DEFAULT_CONFIG.tableOfContents),
|
||||
});
|
||||
|
||||
export {ThemeConfigSchema};
|
||||
export {DEFAULT_CONFIG, ThemeConfigSchema};
|
||||
|
||||
export function validateThemeConfig({
|
||||
validate,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue