diff --git a/gatsby-node.js b/gatsby-node.js index 89fc1db8d9..c1f47f14bb 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -60,15 +60,7 @@ exports.createPages = async ({graphql, boundActionCreators}) => { allMarkdown.data.allMarkdownRemark.edges.forEach(edge => { const slug = edge.node.fields.slug; - if (slug === '/index.html') { - createPage({ - path: '/', - component: homeTemplate, - context: { - slug, - }, - }); - } else if (slug === 'docs/error-decoder.html') { + if (slug === 'docs/error-decoder.html') { // No-op so far as markdown templates go. // Error codes are managed by a page in src/pages // (which gets created by Gatsby during a separate phase). diff --git a/src/templates/home.js b/src/pages/index.js similarity index 94% rename from src/templates/home.js rename to src/pages/index.js index b11d4dddc4..637c0ec088 100644 --- a/src/templates/home.js +++ b/src/pages/index.js @@ -6,7 +6,7 @@ 'use strict'; -import ButtonLink from './components/ButtonLink'; +import ButtonLink from '../templates/components/ButtonLink'; import Container from 'components/Container'; import Flex from 'components/Flex'; import mountCodeExample from 'utils/mountCodeExample'; @@ -41,14 +41,13 @@ class Home extends Component { } render() { - const {data} = this.props; const title = 'React - A JavaScript library for building user interfaces'; return (
-
-
-
+
+
+

Declarative

React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes.

Declarative views make your code more predictable and easier to debug.

-
+

Component-Based

Build encapsulated components that manage their own state, then compose them to make complex UIs.

Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep state out of the DOM.

-
+

Learn Once, Write Anywhere

We don't make assumptions about the rest of your technology stack, so you can develop new features in React without rewriting existing code.

React can also render on the server using Node and power mobile apps using React Native.

-
-
+
+
-
+

A Simple Component

React components implement a `render()` method that takes input data and @@ -180,7 +179,7 @@ class Home extends Component {

-
+

A Stateful Component

In addition to taking input data (accessed via `this.props`), a @@ -190,7 +189,7 @@ class Home extends Component {

-
+

An Application

Using `props` and `state`, we can put together a small Todo application. @@ -201,7 +200,7 @@ class Home extends Component {

-
+

A Component Using External Plugins

React is flexible and provides hooks that allow you to interface with @@ -243,7 +242,6 @@ class Home extends Component { } Home.propTypes = { - data: PropTypes.object.isRequired, location: PropTypes.object.isRequired, }; @@ -285,21 +283,6 @@ const CtaItem = ({children, primary = false}) => (

); -// eslint-disable-next-line no-undef -export const pageQuery = graphql` - query HomeMarkdown($slug: String!) { - markdownRemark(fields: {slug: {eq: $slug}}) { - html - frontmatter { - title - } - fields { - slug - } - } - } -`; - export default Home; // TODO This nasty CSS is required because 'docs/index.md' defines hard-coded class names.