Permalink
Browse files

Add Post list for index

  • Loading branch information...
d-kusk committed Nov 15, 2018
1 parent 9aac1cc commit 84527b6249b612430149cff7c671ed5be8f4f8a3
Showing with 162 additions and 39 deletions.
  1. +4 −0 .env.sample
  2. +30 −1 gatsby-config.js
  3. +5 −3 package.json
  4. +30 −8 src/pages/index.js
  5. +93 −27 yarn.lock
@@ -0,0 +1,4 @@
WORDPRESS_CLIENT_SECRET=""
WORDPRESS_CLIENT_ID=""
WORDPRESS_USER=""
WORDPRESS_PASSWORD=""
@@ -1,8 +1,37 @@
require('dotenv').config()
module.exports = {
siteMetadata: {
title: 'Gatsby Default Starter',
title: 'koniatume',
},
plugins: [
{
resolve: `gatsby-source-wordpress`,
options: {
baseUrl: `gohan52.wordpress.com`,
protocol: `https`,
hostingWPCOM: true,
useACF: false, // default true
auth: {
wpcom_app_clientSecret: process.env.WORDPRESS_CLIENT_SECRET,
wpcom_app_clientId: process.env.WORDPRESS_CLIENT_ID,
wpcom_user: process.env.WORDPRESS_USER,
wpcom_pass: process.env.WORDPRESS_PASSWORD,
},
verboseOutput: true,
perPage: 100,
concurrentRequests: 10,
includedRoutes: [
"/*/*/categories",
"/*/*/posts",
"/*/*/pages",
"/*/*/media",
"/*/*/tags",
"/*/*/taxonomies",
"/*/*/users",
],
}
},
'gatsby-plugin-react-helmet',
{
resolve: `gatsby-source-filesystem`,
@@ -1,16 +1,18 @@
{
"name": "gatsby-starter-default",
"description": "Gatsby default starter",
"name": "koniatume",
"description": "",
"version": "1.0.0",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"author": "Daisuke KONISHI <skydai1151@gmail.com>",
"dependencies": {
"dotenv": "^6.1.0",
"gatsby": "^2.0.19",
"gatsby-image": "^2.0.15",
"gatsby-plugin-manifest": "^2.0.5",
"gatsby-plugin-offline": "^2.0.11",
"gatsby-plugin-react-helmet": "^3.0.0",
"gatsby-plugin-sharp": "^2.0.7",
"gatsby-source-filesystem": "^2.0.4",
"gatsby-source-wordpress": "3.0.0",
"gatsby-transformer-sharp": "^2.1.4",
"react": "^16.5.1",
"react-dom": "^16.5.1",
@@ -2,18 +2,40 @@ import React from 'react'
import { Link } from 'gatsby'
import Layout from '../components/layout'
import Image from '../components/image'
const IndexPage = () => (
const IndexPage = ({data}) => (
<Layout>
<h1>Hi people</h1>
<p>Welcome to your new Gatsby site.</p>
<p>Now go build something great.</p>
<div style={{ maxWidth: '300px', marginBottom: '1.45rem' }}>
<Image />
</div>
<section>
<h2>こにごはん</h2>
<Posts data={data} />
</section>
<Link to="/page-2/">Go to page 2</Link>
</Layout>
)
const Posts = ({ data }) => {
console.log(data);
return (
<div>
{data.allWordpressPost.edges.map(({ node }) => (
<div className="post-item">
<p>{node.title}</p>
</div>
))}
</div>
)
}
export default IndexPage
export const pageQuery = graphql`
query MyFiles {
allWordpressPost {
edges {
node {
title
}
}
}
}
`;
120 yarn.lock

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 84527b6

Please sign in to comment.