Skip to content

Commit

Permalink
💅 Fix identations and some code structure
Browse files Browse the repository at this point in the history
  • Loading branch information
dantehemerson committed Sep 11, 2018
1 parent 1788d45 commit 168baea
Show file tree
Hide file tree
Showing 24 changed files with 656 additions and 757 deletions.
5 changes: 0 additions & 5 deletions .prettierrc

This file was deleted.

242 changes: 121 additions & 121 deletions gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,128 +1,128 @@
module.exports = {
siteMetadata: {
title: 'Dante Calderón',
author: 'Dante Calderón',
description: 'Dante Hemerson Calderón Vasquez, Programmer',
siteUrl: 'https://dantecalderon.com'
},
plugins: [
'gatsby-plugin-react-helmet',
'gatsby-plugin-sass',
{
resolve: 'gatsby-plugin-typography',
options: {
pathToConfigModule: 'src/utils/typography.js',
}

},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'img',
path: `${__dirname}/src/assets/images/`,
}
},
{ // Paginas no utilizado aún.
resolve: 'gatsby-source-filesystem',
options: {
name: 'pages',
path: `${__dirname}/src/pages/`,
}
},
{
resolve: 'gatsby-transformer-remark',
options: {
plugins: [
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 590,
sizeByPixelDensity: true,
},
},
{
resolve: `gatsby-remark-responsive-iframe`,
options: {
wrapperStyle: `margin-bottom: 1.0725rem`,
},
},
{
resolve: `gatsby-remark-autolink-headers`,
options: {
offsetY: `75`,
}
},
{
resolve: 'gatsby-remark-embed-gist',
options: {
username: 'dantehemerson'
}
},
{
resolve: 'gatsby-remark-emojis',
options: {
// Deactivate the plugin globally (default: true)
active : true,
// Add a custom css class
class : 'emoji-icon',
// Select the size (available size: 16, 24, 32, 64)
size : 64,
// Add custom styles
styles : {
display : 'inline',
margin : '0',
position : 'relative'
}
}
},
'gatsby-remark-external-links',
'gatsby-remark-prismjs',
'gatsby-remark-copy-linked-files',
'gatsby-remark-smartypants',
],
siteMetadata: {
title: 'Dante Calderón',
author: 'Dante Calderón',
description: 'Dante Hemerson Calderón Vasquez, Programmer',
siteUrl: 'https://dantecalderon.com'
},
plugins: [
'gatsby-plugin-react-helmet',
'gatsby-plugin-sass',
{
resolve: 'gatsby-plugin-typography',
options: {
pathToConfigModule: 'src/utils/typography.js',
}

},
},
'gatsby-transformer-sharp',
'gatsby-plugin-sharp',
`gatsby-plugin-catch-links`,
'gatsby-plugin-sitemap',
'gatsby-plugin-robots-txt',
{
resolve: `gatsby-plugin-google-analytics`,
options: {
trackingId: 'UA-121858272-1',
head: false,
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'img',
path: `${__dirname}/src/assets/images/`,
}
},
},
'gatsby-plugin-netlify-cms',
{
resolve: `gatsby-plugin-netlify`,
options: {
mergeSecurityHeaders: true,
mergeLinkHeaders: true,
mergeCachingHeaders: true,
generateMatchPathRewrites: true,
{ // Paginas no utilizado aún.
resolve: 'gatsby-source-filesystem',
options: {
name: 'pages',
path: `${__dirname}/src/pages/`,
}
},
},
{
resolve: `gatsby-plugin-nprogress`,
options: {
color: '#dcbb72',
showSpinner: false
{
resolve: 'gatsby-transformer-remark',
options: {
plugins: [
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 590,
sizeByPixelDensity: true,
},
},
{
resolve: `gatsby-remark-responsive-iframe`,
options: {
wrapperStyle: `margin-bottom: 1.0725rem`,
},
},
{
resolve: `gatsby-remark-autolink-headers`,
options: {
offsetY: `75`,
}
},
{
resolve: 'gatsby-remark-embed-gist',
options: {
username: 'dantehemerson'
}
},
{
resolve: 'gatsby-remark-emojis',
options: {
// Deactivate the plugin globally (default: true)
active: true,
// Add a custom css class
class: 'emoji-icon',
// Select the size (available size: 16, 24, 32, 64)
size: 64,
// Add custom styles
styles: {
display: 'inline',
margin: '0',
position: 'relative'
}
}
},
'gatsby-remark-external-links',
'gatsby-remark-prismjs',
'gatsby-remark-copy-linked-files',
'gatsby-remark-smartypants',
],
},
},
},
`gatsby-plugin-offline`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: 'Dante Calderon',
short_name: 'Dante',
start_url: '/',
background_color: '#DFBD83',
theme_color: '#DFBD83',
display: 'minimal-ui',
'gatsby-transformer-sharp',
'gatsby-plugin-sharp',
`gatsby-plugin-catch-links`,
'gatsby-plugin-sitemap',
'gatsby-plugin-robots-txt',
{
resolve: `gatsby-plugin-google-analytics`,
options: {
trackingId: 'UA-121858272-1',
head: false,
},
},
},
`gatsby-plugin-styled-components`,
],
'gatsby-plugin-netlify-cms',
{
resolve: `gatsby-plugin-netlify`,
options: {
mergeSecurityHeaders: true,
mergeLinkHeaders: true,
mergeCachingHeaders: true,
generateMatchPathRewrites: true,
},
},
{
resolve: `gatsby-plugin-nprogress`,
options: {
color: '#dcbb72',
showSpinner: false
},
},
`gatsby-plugin-offline`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: 'Dante Calderon',
short_name: 'Dante',
start_url: '/',
background_color: '#DFBD83',
theme_color: '#DFBD83',
display: 'minimal-ui',
},
},
`gatsby-plugin-styled-components`,
],
}
121 changes: 59 additions & 62 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ const path = require('path')
const { createFilePath } = require('gatsby-source-filesystem')

exports.createPages = ({ graphql, boundActionCreators }) => {
const { createPage } = boundActionCreators

return new Promise((resolve, reject) => {
const blogPost = path.resolve('./src/templates/blogTemplate.js')
resolve(
graphql(
`
const { createPage } = boundActionCreators
return new Promise((resolve, reject) => {
const blogPost = path.resolve('./src/templates/blogTemplate.js')
resolve(
graphql(
`
{
allMarkdownRemark(
sort: { fields: [frontmatter___date], order: DESC }
Expand All @@ -33,67 +32,65 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
}
}
`
).then(result => {
if (result.errors) {
console.log(result.errors)
reject(result.errors)
}
).then(result => {
if (result.errors) {
console.log(result.errors)
reject(result.errors)
}

const posts = result.data.allMarkdownRemark.edges
const posts = result.data.allMarkdownRemark.edges

_.each(posts, (post, index) => {
const previous =
index === posts.length - 1 ? null : posts[index + 1].node
const next = index === 0 ? null : posts[index - 1].node
_.each(posts, (post, index) => {
const previous =
index === posts.length - 1 ? null : posts[index + 1].node
const next = index === 0 ? null : posts[index - 1].node

createPage({
path: post.node.frontmatter.path.trim(),
component: blogPost,
context: {
slug: post.node.frontmatter.path,
previous,
next,
},
})
})
})
)
})
createPage({
path: post.node.frontmatter.path.trim(),
component: blogPost,
context: {
slug: post.node.frontmatter.path,
previous,
next,
},
})
})
})
)
})
}

exports.onCreateNode = ({ node, boundActionCreators, getNode }) => {
const { createNodeField } = boundActionCreators
const { frontmatter } = node

if (frontmatter) {
const { thumbnail, model } = frontmatter
if (thumbnail) {
if(model === 'post') {
if (thumbnail.indexOf('/img') === 0) {
createNodeField({
name: `thumbnail`,
node,
value: `.${thumbnail}`,
})
}
}
else if(model === 'project') {
createNodeField({
name: 'thumbnail',
node,
value: `../posts${thumbnail}`,
})
}

}
}
const { createNodeField } = boundActionCreators
const { frontmatter } = node

if (frontmatter) {
const { thumbnail, model } = frontmatter
if (thumbnail) {
if (model === 'post') {
if (thumbnail.indexOf('/img') === 0) {
createNodeField({
name: `thumbnail`,
node,
value: `.${thumbnail}`,
})
}
}
else if (model === 'project') {
createNodeField({
name: 'thumbnail',
node,
value: `../posts${thumbnail}`,
})
}

if (node.internal.type === `MarkdownRemark`) {
createNodeField({
name: `slug`,
node,
value: `/${frontmatter.path}`,
})
}
}
}
if (node.internal.type === `MarkdownRemark`) {
createNodeField({
name: `slug`,
node,
value: `/${frontmatter.path}`,
})
}
}
Loading

0 comments on commit 168baea

Please sign in to comment.