|
|
@ -23,15 +23,17 @@ export const Seo = withRouter( |
|
|
|
router, |
|
|
|
children, |
|
|
|
isHomePage, |
|
|
|
}: SeoProps & {router: Router}) => ( |
|
|
|
}: SeoProps & {router: Router}) => { |
|
|
|
const pageTitle = isHomePage ? 'React' : title + ' – React'; |
|
|
|
// Twitter's meta parser is not very good.
|
|
|
|
const twitterTitle = pageTitle.replace(/[<>]/g, ''); |
|
|
|
return ( |
|
|
|
<Head> |
|
|
|
{/* DEFAULT */} |
|
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" /> |
|
|
|
|
|
|
|
{title != null && ( |
|
|
|
<title key="title">{title + (isHomePage ? '' : ' – React')}</title> |
|
|
|
)} |
|
|
|
{title != null && <title key="title">{pageTitle}</title>} |
|
|
|
{description != null && ( |
|
|
|
<meta name="description" key="description" content={description} /> |
|
|
|
)} |
|
|
@ -46,11 +48,7 @@ export const Seo = withRouter( |
|
|
|
content={`https://react.dev${router.asPath.split(/[\?\#]/)[0]}`} |
|
|
|
/> |
|
|
|
{title != null && ( |
|
|
|
<meta |
|
|
|
property="og:title" |
|
|
|
content={isHomePage ? 'React' : title} |
|
|
|
key="og:title" |
|
|
|
/> |
|
|
|
<meta property="og:title" content={pageTitle} key="og:title" /> |
|
|
|
)} |
|
|
|
{description != null && ( |
|
|
|
<meta |
|
|
@ -78,7 +76,7 @@ export const Seo = withRouter( |
|
|
|
<meta |
|
|
|
name="twitter:title" |
|
|
|
key="twitter:title" |
|
|
|
content={isHomePage ? 'React' : title} |
|
|
|
content={twitterTitle} |
|
|
|
/> |
|
|
|
)} |
|
|
|
{description != null && ( |
|
|
@ -142,5 +140,6 @@ export const Seo = withRouter( |
|
|
|
/> |
|
|
|
{children} |
|
|
|
</Head> |
|
|
|
) |
|
|
|
); |
|
|
|
} |
|
|
|
); |
|
|
|