Skip to content

Commit

Permalink
fix(v2): unbreak adding of custom HTML metadatas (#4871)
Browse files Browse the repository at this point in the history
* fix(v2): unbreak adding of custom HTML metadatas

* Correct solution

* Update website/docusaurus.config.js

Co-authored-by: Sébastien Lorber <[email protected]>
  • Loading branch information
lex111 and slorber authored Jun 2, 2021
1 parent 57a0a69 commit 35b1941
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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}} />
Expand Down
1 change: 0 additions & 1 deletion packages/docusaurus-theme-classic/src/theme/Seo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export type ThemeConfig = {
footer?: Footer;
hideableSidebar: boolean;
image: string;
metadatas: Array<Record<string, string>>;
};

export function useThemeConfig(): ThemeConfig {
Expand Down

0 comments on commit 35b1941

Please sign in to comment.