fix(v2): unbreak adding of custom HTML metadatas (#4871)

* fix(v2): unbreak adding of custom HTML metadatas

* Correct solution

* Update website/docusaurus.config.js

Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
This commit is contained in:
Alexey Pyltsyn 2021-06-02 13:20:32 +03:00 committed by GitHub
parent 57a0a69137
commit 35b1941a0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View file

@ -85,7 +85,7 @@ export default function LayoutHead(props: Props): JSX.Element {
const {
siteConfig: {
favicon,
themeConfig: {metadatas},
themeConfig: {metadatas, image: defaultImage},
},
i18n: {currentLocale, localeConfigs},
} = useDocusaurusContext();
@ -105,6 +105,10 @@ export default function LayoutHead(props: Props): JSX.Element {
{favicon && <link rel="shortcut icon" href={faviconUrl} />}
<title>{pageTitle}</title>
<meta property="og:title" content={pageTitle} />
{image ||
(defaultImage && (
<meta name="twitter:card" content="summary_large_image" />
))}
</Head>
<Seo {...{description, keywords, image}} />

View file

@ -41,7 +41,6 @@ export default function Seo({
{pageImage && <meta property="og:image" content={pageImage} />}
{pageImage && <meta name="twitter:image" content={pageImage} />}
{pageImage && <meta name="twitter:card" content="summary_large_image" />}
</Head>
);
}

View file

@ -102,6 +102,7 @@ export type ThemeConfig = {
footer?: Footer;
hideableSidebar: boolean;
image: string;
metadatas: Array<Record<string, string>>;
};
export function useThemeConfig(): ThemeConfig {