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

View file

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

View file

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