Skip to content

Commit

Permalink
Merge pull request #92 from jcmnunes/#34-Create-a-template-for-the-wo…
Browse files Browse the repository at this point in the history
…rk-single-page

#34 create a template for the work single page
  • Loading branch information
jcmnunes committed Aug 25, 2018
2 parents a0d2d0c + 5cc04e7 commit d114ffb
Show file tree
Hide file tree
Showing 34 changed files with 2,662 additions and 9,438 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -6,3 +6,5 @@ node_modules
public/
.DS_Store
yarn-error.log
.idea

7 changes: 6 additions & 1 deletion .stylelintrc
Expand Up @@ -9,5 +9,10 @@
"rules": {
"scale-unlimited/declaration-strict-value": "/color/"
},
"ignoreFiles": ["src/assets/styles/vendor/*.css", "src/pages/*.js"]
"ignoreFiles": [
"src/assets/styles/vendor/*.css",
"src/pages/*.js",
"src/components/*.js",
"src/templates/*.js"
]
}
24 changes: 22 additions & 2 deletions gatsby-config.js
Expand Up @@ -5,9 +5,29 @@ module.exports = {
plugins: [
'gatsby-plugin-react-helmet',
'gatsby-plugin-react-next',
'gatsby-transformer-sharp',
'gatsby-plugin-sharp',
'gatsby-transformer-remark',
'gatsby-transformer-sharp',
{
resolve: 'gatsby-transformer-remark',
options: {
plugins: [
'gatsby-remark-prismjs',
{
resolve: 'gatsby-remark-relative-images',
},
{
resolve: 'gatsby-remark-images',
options: {
// It's important to specify the maxWidth (in pixels) of
// the content container as this plugin uses this as the
// base for generating different widths of each image.
maxWidth: 700,
// wrapperStyle: 'margin: 15px -30px !important',
},
},
],
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
Expand Down
13 changes: 12 additions & 1 deletion gatsby-node.js
Expand Up @@ -14,6 +14,17 @@ exports.onCreateNode = ({ node, getNode, boundActionCreators }) => {
name: 'slug',
value: `/works${slug}`,
});

if (node.frontmatter.relpath && node.frontmatter.heroImage) {
const { relpath, heroImage } = node.frontmatter;
const heroImagePath = relpath + heroImage;

createNodeField({
node,
name: 'heroImage',
value: heroImagePath,
});
}
}
};

Expand All @@ -36,7 +47,7 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
result.data.allMarkdownRemark.edges.forEach(({ node }) => {
createPage({
path: node.fields.slug,
component: path.resolve('./src/layouts/WorkSingle.js'),
component: path.resolve('./src/templates/WorkSingle.js'),
context: {
slug: node.fields.slug,
},
Expand Down

0 comments on commit d114ffb

Please sign in to comment.