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 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 {