Skip to content

Commit 8ef7f02

Browse files
committed
set up
1 parent 0274371 commit 8ef7f02

30 files changed

+20692
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
.cache
3+
public
4+
.DS_Store

assets/blog-hero.svg

Lines changed: 9 additions & 0 deletions
Loading

assets/logo.svg

Lines changed: 4 additions & 0 deletions
Loading

gatsby-browser.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
import './src/styles/global.css';
3+
import './src/styles/navbar.scss';

gatsby-config.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const path = require(`path`)
2+
3+
module.exports = {
4+
/* Your site config here */
5+
pathPrefix: "/web-dev",
6+
plugins: [
7+
`gatsby-transformer-sharp`,
8+
`gatsby-plugin-sharp`,
9+
'gatsby-plugin-postcss',
10+
'gatsby-plugin-sass',
11+
{
12+
resolve: `gatsby-source-filesystem`,
13+
options: {
14+
name: `images`,
15+
path: path.join(__dirname, `static`),
16+
},
17+
},
18+
{
19+
resolve: "gatsby-plugin-react-svg",
20+
options: {
21+
rule: {
22+
include: /assets/ // See below to configure properly
23+
}
24+
}
25+
},
26+
{
27+
resolve: "gatsby-plugin-anchor-links",
28+
options: {
29+
offset: -100
30+
}
31+
},
32+
{
33+
resolve: `gatsby-source-ghost`,
34+
options: {
35+
apiUrl: `https://sdv.ghost.io`,
36+
contentApiKey: `68a3f60d2555e5dff8a5df9e11`,
37+
},
38+
}
39+
],
40+
}

gatsby-node.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
const path = require(`path`)
2+
3+
exports.createPages = async ({ graphql, actions, reporter }) => {
4+
const postTemplate = path.resolve(`./src/templates/post.js`)
5+
6+
// Query Ghost data
7+
const result = await graphql(`
8+
{
9+
allGhostPost(sort: { order: ASC, fields: published_at }) {
10+
edges {
11+
node {
12+
slug
13+
}
14+
}
15+
}
16+
}
17+
`)
18+
19+
// Handle errors
20+
if (result.errors) {
21+
reporter.panicOnBuild(`Error while running GraphQL query.`)
22+
return
23+
}
24+
25+
if (!result.data.allGhostPost) {
26+
return
27+
}
28+
29+
// Create pages for each Ghost post
30+
const items = result.data.allGhostPost.edges
31+
items.forEach(({ node }) => {
32+
node.url = `/${node.slug}/`
33+
34+
actions.createPage({
35+
path: node.url,
36+
component: postTemplate,
37+
context: {
38+
slug: node.slug,
39+
},
40+
})
41+
})
42+
}

0 commit comments

Comments
 (0)