feat(v2): supports string type for the Layout's keywords props (#4090)

* feat(v2): support string type for the keywords props

* Update the type definition of Layout
This commit is contained in:
Welly 2021-01-28 00:42:22 +08:00 committed by GitHub
parent 95f81d2a44
commit 6917eb950c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -81,7 +81,10 @@ export default function LayoutHead(props: Props): JSX.Element {
<meta property="og:description" content={description} />
)}
{keywords && keywords.length && (
<meta name="keywords" content={keywords.join(',')} />
<meta
name="keywords"
content={Array.isArray(keywords) ? keywords.join(',') : keywords}
/>
)}
{metaImage && <meta property="og:image" content={metaImageUrl} />}
{metaImage && <meta name="twitter:image" content={metaImageUrl} />}

View file

@ -237,7 +237,7 @@ declare module '@theme/Layout' {
noFooter?: boolean;
description?: string;
image?: string;
keywords?: string[];
keywords?: string | string[];
permalink?: string;
wrapperClassName?: string;
searchMetadatas?: {