From 67de95ba5a811836a333b9df3225026c88805e94 Mon Sep 17 00:00:00 2001 From: Bradley Woods Date: Wed, 26 Sep 2018 20:09:10 +1000 Subject: [PATCH 1/2] Update layout to match convention --- src/components/layout.js | 4 ++-- src/pages/index.js | 2 +- src/templates/blog-post.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/layout.js b/src/components/layout.js index e0222fd..370484e 100644 --- a/src/components/layout.js +++ b/src/components/layout.js @@ -3,7 +3,7 @@ import { Link } from 'gatsby' import { rhythm, scale } from '../utils/typography' -class Template extends React.Component { +class Layout extends React.Component { render() { const { location, children } = this.props const rootPath = `${__PATH_PREFIX__}/` @@ -68,4 +68,4 @@ class Template extends React.Component { } } -export default Template +export default Layout diff --git a/src/pages/index.js b/src/pages/index.js index bdc3143..fb52679 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -4,7 +4,7 @@ import get from 'lodash/get' import Helmet from 'react-helmet' import Bio from '../components/Bio' -import Layout from '../components/layout' +import Layout from '../components/Layout' import { rhythm } from '../utils/typography' class BlogIndex extends React.Component { diff --git a/src/templates/blog-post.js b/src/templates/blog-post.js index 2ae77f5..020b522 100644 --- a/src/templates/blog-post.js +++ b/src/templates/blog-post.js @@ -4,7 +4,7 @@ import { Link,graphql } from 'gatsby' import get from 'lodash/get' import Bio from '../components/Bio' -import Layout from '../components/layout' +import Layout from '../components/Layout' import { rhythm, scale } from '../utils/typography' class BlogPostTemplate extends React.Component { From 18caedf7f9ddf0fac725f2167c33fa76adddf9e0 Mon Sep 17 00:00:00 2001 From: Bradley Woods Date: Wed, 26 Sep 2018 20:33:35 +1000 Subject: [PATCH 2/2] Fix layout filename --- src/components/Layout.js | 71 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/components/Layout.js diff --git a/src/components/Layout.js b/src/components/Layout.js new file mode 100644 index 0000000..370484e --- /dev/null +++ b/src/components/Layout.js @@ -0,0 +1,71 @@ +import React from 'react' +import { Link } from 'gatsby' + +import { rhythm, scale } from '../utils/typography' + +class Layout extends React.Component { + render() { + const { location, children } = this.props + const rootPath = `${__PATH_PREFIX__}/` + let header + + if (location.pathname === rootPath) { + header = ( +

+ + Gatsby Starter Blog + +

+ ) + } else { + header = ( +

+ + Gatsby Starter Blog + +

+ ) + } + return ( +
+ {header} + {children} +
+ ) + } +} + +export default Layout