-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit from gatsby: (https://github.com/juliettepretot/gatsby…
- Loading branch information
0 parents
commit a7b3a49
Showing
19 changed files
with
15,746 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"presets": [["babel-preset-gatsby"]], | ||
"plugins": [["babel-plugin-root-import", { "rootPathSuffix": "src" }]] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Project dependencies | ||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git | ||
node_modules | ||
.cache/ | ||
.vscode/ | ||
# Build directory | ||
public/ | ||
.DS_Store | ||
yarn-error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## Tech Stack 🥞 | ||
|
||
##### Linting & Formatting | ||
|
||
The code is formatted (prettier), linted & type-checked using commit hooks. | ||
|
||
##### Data | ||
|
||
Content is stored in markdown files. | ||
|
||
##### Styling | ||
|
||
Styling is set up using Styled Components. | ||
|
||
--- | ||
|
||
## License 🔓 | ||
|
||
MIT. :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict' | ||
|
||
module.exports = { | ||
siteMetadata: { | ||
title: 'Juliette Pretot', | ||
description: 'Gatsby TypeScript Skeleton Starter', | ||
siteUrl: 'https://juliette.sh', | ||
author: { | ||
name: 'Juliette Pretot', | ||
url: 'https://juliette.sh', | ||
email: '[email protected]' | ||
} | ||
}, | ||
plugins: [ | ||
{ | ||
resolve: 'gatsby-source-filesystem', | ||
options: { | ||
name: 'src', | ||
path: `${__dirname}/src` | ||
} | ||
}, | ||
'gatsby-transformer-remark', | ||
'gatsby-plugin-styled-components', | ||
'gatsby-plugin-typescript', | ||
'gatsby-plugin-react-helmet', | ||
'gatsby-plugin-catch-links', | ||
'gatsby-plugin-offline' | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
'use strict' | ||
|
||
/* | ||
Configure Gatsby to create pages from markdown files in ./src/markdownPages | ||
*/ | ||
|
||
const pathUtil = require('path') | ||
const { createFilePath } = require('gatsby-source-filesystem') | ||
|
||
const MARKDOWN_PAGE_TEMPLATE = './src/components/MarkdownPage/index.tsx' | ||
|
||
exports.onCreateNode = ({ node, actions, getNode }) => { | ||
if (node.internal.type === 'MarkdownRemark') { | ||
const filePath = createFilePath({ node, getNode }) | ||
const slug = filePath.startsWith('/pages') ? filePath.replace('/pages', '/') : '' | ||
|
||
actions.createNodeField({ | ||
node, | ||
name: 'slug', | ||
value: slug | ||
}) | ||
|
||
actions.createNodeField({ | ||
node, | ||
name: 'isPage', | ||
value: !!slug | ||
}) | ||
} | ||
} | ||
|
||
exports.createPages = async ({ graphql, actions }) => { | ||
const { createPage } = actions | ||
|
||
const allMarkdown = await graphql(` | ||
{ | ||
allMarkdownRemark(limit: 1000) { | ||
edges { | ||
node { | ||
fields { | ||
isPage | ||
slug | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`) | ||
|
||
if (allMarkdown.errors) { | ||
console.error(allMarkdown.errors) | ||
throw new Error(allMarkdown.errors) | ||
} | ||
|
||
allMarkdown.data.allMarkdownRemark.edges | ||
.filter(({ node }) => !!node.fields.isPage) | ||
.forEach(({ node }) => { | ||
const { slug } = node.fields | ||
|
||
createPage({ | ||
path: slug, | ||
component: pathUtil.resolve(MARKDOWN_PAGE_TEMPLATE), | ||
context: { | ||
// Data passed to context is available in page queries as GraphQL | ||
// variables. | ||
slug | ||
} | ||
}) | ||
}) | ||
} |
Oops, something went wrong.