@samitouri / QOS-React-2 / commits / bbb272f3aa

Fix 404 for warning URLs (#11038)

Dan Abramov committed Oct 2, 2017 at 20:12 UTC bbb272f3aae322bf2b13db862356d78957bafac7
2 files changed +10 -3
www/gatsby-node.js
+7 -2
@@ -85,14 +85,19 @@ exports.createPages = async ({graphql, boundActionCreators}) => {
85 slug.includes('community/') ||
86 slug.includes('contributing/') ||
87 slug.includes('docs/') ||
88 - slug.includes('tutorial/')
88 + slug.includes('tutorial/') ||
89 + slug.includes('warnings/')
90 ) {
91 let template;
92 if (slug.includes('blog/')) {
93 template = blogTemplate;
94 } else if (slug.includes('community/')) {
95 template = communityTemplate;
95 - } else if (slug.includes('contributing/') || slug.includes('docs/')) {
96 + } else if (
97 + slug.includes('contributing/') ||
98 + slug.includes('docs/') ||
99 + slug.includes('warnings/')
100 + ) {
101 template = docsTemplate;
102 } else if (slug.includes('tutorial/')) {
103 template = tutorialTemplate;
www/src/layouts/index.js
+3 -1
@@ -44,7 +44,9 @@ class Template extends Component {
44 // TODO - is there a better way to check if we need we have a sidebar?
45 let layoutHasSidebar = false;
46 if (
47 - location.pathname.match(/^\/(docs|tutorial|community|blog|contributing)/)
47 + location.pathname.match(
48 + /^\/(docs|tutorial|community|blog|contributing|warnings)/,
49 + )
50 ) {
51 layoutHasSidebar = true;
52 }