mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-30 02:37:59 +02:00
feat: implement in BlogPostPage-remove Seo changes
This commit is contained in:
parent
88e6d74609
commit
1cba459bc9
4 changed files with 12 additions and 16 deletions
|
@ -132,7 +132,6 @@ declare module '@theme/Seo' {
|
|||
readonly description?: string;
|
||||
readonly keywords?: readonly string[] | string;
|
||||
readonly image?: string;
|
||||
readonly children?: ReactNode;
|
||||
};
|
||||
|
||||
const Seo: (props: Props) => JSX.Element;
|
||||
|
|
|
@ -129,18 +129,7 @@ function BlogPostItem(props: Props): JSX.Element {
|
|||
|
||||
return (
|
||||
<>
|
||||
{isBlogPostPage ? (
|
||||
<Seo {...{keywords, image}}>
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="article:published_time" content={date} />
|
||||
{authorURL && <meta property="article:author" content={authorURL} />}
|
||||
{frontMatter.tags && (
|
||||
<meta property="article:tag" content={frontMatter.tags.join(',')} />
|
||||
)}
|
||||
</Seo>
|
||||
) : (
|
||||
<Seo {...{keywords, image}} />
|
||||
)}
|
||||
<Seo {...{keywords, image}} />
|
||||
|
||||
<article
|
||||
className={!isBlogPostPage ? 'margin-bottom--xl' : undefined}
|
||||
|
|
|
@ -11,12 +11,14 @@ import BlogPostItem from '@theme/BlogPostItem';
|
|||
import BlogPostPaginator from '@theme/BlogPostPaginator';
|
||||
import type {Props} from '@theme/BlogPostPage';
|
||||
import {ThemeClassNames} from '@docusaurus/theme-common';
|
||||
import Head from '@docusaurus/Head';
|
||||
|
||||
function BlogPostPage(props: Props): JSX.Element {
|
||||
const {content: BlogPostContents, sidebar} = props;
|
||||
const {frontMatter, frontMatterAssets, metadata} = BlogPostContents;
|
||||
const {title, description, nextItem, prevItem} = metadata;
|
||||
const {title, description, nextItem, prevItem, date} = metadata;
|
||||
const {hide_table_of_contents: hideTableOfContents} = frontMatter;
|
||||
const authorURL = frontMatter.author_url || frontMatter.authorURL;
|
||||
|
||||
return (
|
||||
<BlogLayout
|
||||
|
@ -30,6 +32,14 @@ function BlogPostPage(props: Props): JSX.Element {
|
|||
? BlogPostContents.toc
|
||||
: undefined
|
||||
}>
|
||||
<Head>
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="article:published_time" content={date} />
|
||||
{authorURL && <meta property="article:author" content={authorURL} />}
|
||||
{frontMatter.tags && (
|
||||
<meta property="article:tag" content={frontMatter.tags.join(',')} />
|
||||
)}
|
||||
</Head>
|
||||
<BlogPostItem
|
||||
frontMatter={frontMatter}
|
||||
frontMatterAssets={frontMatterAssets}
|
||||
|
|
|
@ -17,7 +17,6 @@ export default function Seo({
|
|||
description,
|
||||
keywords,
|
||||
image,
|
||||
children,
|
||||
}: Props): JSX.Element {
|
||||
const {image: defaultImage} = useThemeConfig();
|
||||
const pageTitle = useTitleFormatter(title);
|
||||
|
@ -42,7 +41,6 @@ export default function Seo({
|
|||
|
||||
{pageImage && <meta property="og:image" content={pageImage} />}
|
||||
{pageImage && <meta name="twitter:image" content={pageImage} />}
|
||||
{children}
|
||||
</Head>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue