diff --git a/www/src/components/MarkdownPage/MarkdownPage.js b/www/src/components/MarkdownPage/MarkdownPage.js index 49c0b379d7..48e2abe729 100644 --- a/www/src/components/MarkdownPage/MarkdownPage.js +++ b/www/src/components/MarkdownPage/MarkdownPage.js @@ -20,7 +20,7 @@ import TitleAndMetaTags from 'components/TitleAndMetaTags'; import findSectionForPath from 'utils/findSectionForPath'; import toCommaSeparatedList from 'utils/toCommaSeparatedList'; import {sharedStyles} from 'theme'; -import {urlRoot} from 'constants'; +import createOgUrl from 'utils/createOgUrl'; const MarkdownPage = ({ authors, @@ -48,9 +48,9 @@ const MarkdownPage = ({ zIndex: 0, }}>
diff --git a/www/src/constants.js b/www/src/site-constants.js similarity index 100% rename from www/src/constants.js rename to www/src/site-constants.js diff --git a/www/src/templates/blog.js b/www/src/templates/blog.js index 2d80c36b57..add1b21d78 100644 --- a/www/src/templates/blog.js +++ b/www/src/templates/blog.js @@ -66,6 +66,7 @@ export const pageQuery = graphql` fields { date(formatString: "MMMM DD, YYYY") path + slug } } allMarkdownRemark( diff --git a/www/src/templates/community.js b/www/src/templates/community.js index c44cee86f0..a6b6282467 100644 --- a/www/src/templates/community.js +++ b/www/src/templates/community.js @@ -41,6 +41,7 @@ export const pageQuery = graphql` } fields { path + slug } } } diff --git a/www/src/templates/docs.js b/www/src/templates/docs.js index ea023a8e53..d801b5d8fd 100644 --- a/www/src/templates/docs.js +++ b/www/src/templates/docs.js @@ -41,6 +41,7 @@ export const pageQuery = graphql` } fields { path + slug } } } diff --git a/www/src/templates/home.js b/www/src/templates/home.js index 46fad5f86c..5e3f517227 100644 --- a/www/src/templates/home.js +++ b/www/src/templates/home.js @@ -17,7 +17,7 @@ import PropTypes from 'prop-types'; import React, {Component} from 'react'; import TitleAndMetaTags from 'components/TitleAndMetaTags'; import {colors, media, sharedStyles} from 'theme'; -import {urlRoot} from 'constants'; +import createOgUrl from 'utils/createOgUrl'; class Home extends Component { componentDidMount() { @@ -35,7 +35,7 @@ class Home extends Component {
@@ -211,6 +211,7 @@ export const pageQuery = graphql` } fields { path + slug } } } diff --git a/www/src/templates/tutorial.js b/www/src/templates/tutorial.js index d1d230c538..20afb8579d 100644 --- a/www/src/templates/tutorial.js +++ b/www/src/templates/tutorial.js @@ -52,6 +52,7 @@ export const pageQuery = graphql` } fields { path + slug } } } diff --git a/www/src/utils/createOgUrl.js b/www/src/utils/createOgUrl.js new file mode 100644 index 0000000000..9db20dafca --- /dev/null +++ b/www/src/utils/createOgUrl.js @@ -0,0 +1,15 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails react-core + */ + +'use strict'; + +import {urlRoot} from 'site-constants'; + +export default slug => + (slug == null ? null : `${urlRoot}/${slug.replace(/^\//, '')}`);