Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/MarkdownPage/MarkdownPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import TitleAndMetaTags from 'components/TitleAndMetaTags';
import findSectionForPath from 'utils/findSectionForPath';
import toCommaSeparatedList from 'utils/toCommaSeparatedList';
import {sharedStyles} from 'theme';
import createOgUrl from 'utils/createOgUrl';
import createCanonicalUrl from 'utils/createCanonicalUrl';

import type {Node} from 'types';

Expand Down Expand Up @@ -74,7 +74,7 @@ const MarkdownPage = ({
}}>
<TitleAndMetaTags
ogDescription={ogDescription}
ogUrl={createOgUrl(markdownRemark.fields.slug)}
canonicalUrl={createCanonicalUrl(markdownRemark.fields.slug)}
title={`${titlePrefix}${titlePostfix}`}
/>
<div css={{flex: '1 0 auto'}}>
Expand Down
7 changes: 4 additions & 3 deletions src/components/TitleAndMetaTags/TitleAndMetaTags.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,22 @@ const defaultDescription = 'A JavaScript library for building user interfaces';
type Props = {
title: string,
ogDescription: string,
ogUrl: string,
canonicalUrl: string,
};

const TitleAndMetaTags = ({title, ogDescription, ogUrl}: Props) => {
const TitleAndMetaTags = ({title, ogDescription, canonicalUrl}: Props) => {
return (
<Helmet title={title}>
<meta property="og:title" content={title} />
<meta property="og:type" content="website" />
{ogUrl && <meta property="og:url" content={ogUrl} />}
{canonicalUrl && <meta property="og:url" content={canonicalUrl} />}
<meta property="og:image" content="/logo-og.png" />
<meta
property="og:description"
content={ogDescription || defaultDescription}
/>
<meta property="fb:app_id" content="623268441017527" />
{canonicalUrl && <link rel="canonical" href={canonicalUrl} />}
</Helmet>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/pages/acknowledgements.html.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Acknowlegements = ({data, location}) => (
<div css={sharedStyles.articleLayout.content}>
<Header>Acknowledgements</Header>
<TitleAndMetaTags
ogUrl={`${urlRoot}/acknowledgements.html`}
canonicalUrl={`${urlRoot}/acknowledgements.html`}
title="React - Acknowledgements"
/>

Expand Down
2 changes: 1 addition & 1 deletion src/pages/blog/all.html.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const AllBlogPosts = ({data, location}: Props) => (
<div css={sharedStyles.articleLayout.content}>
<Header>All Posts</Header>
<TitleAndMetaTags
ogUrl={`${urlRoot}/blog/all.html`}
canonicalUrl={`${urlRoot}/blog/all.html`}
title="React - All Posts"
/>
<ul
Expand Down
4 changes: 2 additions & 2 deletions src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import TitleAndMetaTags from 'components/TitleAndMetaTags';
import Layout from 'components/Layout';
import {colors, media, sharedStyles} from 'theme';
import loadScript from 'utils/loadScript';
import createOgUrl from 'utils/createOgUrl';
import createCanonicalUrl from 'utils/createCanonicalUrl';
import {babelURL} from 'site-constants';
import logoWhiteSvg from 'icons/logo-white.svg';

Expand Down Expand Up @@ -51,7 +51,7 @@ class Home extends Component {
<Layout location={location}>
<TitleAndMetaTags
title="React &ndash; A JavaScript library for building user interfaces"
ogUrl={createOgUrl('index.html')}
canonicalUrl={createCanonicalUrl('/')}
/>
<div css={{width: '100%'}}>
<header
Expand Down
6 changes: 5 additions & 1 deletion src/pages/languages.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Container from 'components/Container';
import Header from 'components/Header';
import TitleAndMetaTags from 'components/TitleAndMetaTags';
import React from 'react';
import {urlRoot} from 'site-constants';
import {media, sharedStyles} from 'theme';

// $FlowFixMe This is a valid path
Expand Down Expand Up @@ -47,7 +48,10 @@ const Languages = ({location}: Props) => (
<div css={sharedStyles.articleLayout.container}>
<div css={sharedStyles.articleLayout.content}>
<Header>Languages</Header>
<TitleAndMetaTags title="React - Languages" />
<TitleAndMetaTags
canonicalUrl={`${urlRoot}/languages/`}
title="React - Languages"
/>

<div css={sharedStyles.markdown}>
<p>
Expand Down
6 changes: 5 additions & 1 deletion src/pages/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Container from 'components/Container';
import Header from 'components/Header';
import TitleAndMetaTags from 'components/TitleAndMetaTags';
import React from 'react';
import {urlRoot} from 'site-constants';
import {sharedStyles} from 'theme';

// $FlowFixMe This is a valid path
Expand All @@ -25,7 +26,10 @@ const Versions = ({location}: Props) => (
<div css={sharedStyles.articleLayout.container}>
<div css={sharedStyles.articleLayout.content}>
<Header>React Versions</Header>
<TitleAndMetaTags title="React - Versions" />
<TitleAndMetaTags
canonicalUrl={`${urlRoot}/versions/`}
title="React - Versions"
/>
<div css={sharedStyles.markdown}>
<p>
A complete release history for React is available{' '}
Expand Down
File renamed without changes.