Browse Source

Make og:type article for markdown pages (#3146) (#3147)

main
David Barratt 5 years ago
committed by GitHub
parent
commit
08503a8318
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/components/MarkdownPage/MarkdownPage.js
  2. 10
      src/components/TitleAndMetaTags/TitleAndMetaTags.js

1
src/components/MarkdownPage/MarkdownPage.js

@ -74,6 +74,7 @@ const MarkdownPage = ({
}}>
<TitleAndMetaTags
ogDescription={ogDescription}
ogType="article"
canonicalUrl={createCanonicalUrl(markdownRemark.fields.slug)}
title={`${titlePrefix}${titlePostfix}`}
/>

10
src/components/TitleAndMetaTags/TitleAndMetaTags.js

@ -17,6 +17,7 @@ type Props = {
title: string,
ogDescription: string,
canonicalUrl: string,
ogType: string,
};
// only provide alternate links to pages in languages where 95-100% of core content has been translated
@ -45,11 +46,16 @@ const defaultPage = canonicalUrl => {
return canonicalUrl.replace(urlRoot, 'https://reactjs.org');
};
const TitleAndMetaTags = ({title, ogDescription, canonicalUrl}: Props) => {
const TitleAndMetaTags = ({
title,
ogDescription,
canonicalUrl,
ogType = 'website',
}: Props) => {
return (
<Helmet title={title}>
<meta property="og:title" content={title} />
<meta property="og:type" content="website" />
<meta property="og:type" content={ogType} />
{canonicalUrl && <meta property="og:url" content={canonicalUrl} />}
<meta property="og:image" content="https://reactjs.org/logo-og.png" />
<meta

Loading…
Cancel
Save