Skip to content

Commit d933353

Browse files
author
Roman Ponomarev
committed
Init
0 parents  commit d933353

File tree

25 files changed

+20008
-0
lines changed

25 files changed

+20008
-0
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public

.eslintrc.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
extends: [
3+
'standard',
4+
'plugin:react/recommended'
5+
],
6+
rules: {
7+
semi: ['error', 'always'],
8+
'space-before-function-paren': ['error', 'never'],
9+
'react/prop-types': [0]
10+
},
11+
globals: {
12+
'graphql': true,
13+
'__PREFIX_PATHS__': true,
14+
'__PATH_PREFIX__': true
15+
}
16+
};

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules/
2+
public
3+
.gatsby-context.js
4+
.DS_Store
5+
.intermediate-representation/
6+
.cache/
7+
yarn.lock

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# frontend.youknow
2+
3+

gatsby-config.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
module.exports = {
2+
siteMetadata: {
3+
title: 'frontend.youknow',
4+
author: '`Roman Ponomarev',
5+
description: '',
6+
siteUrl: 'https://frontend.youknow.st'
7+
},
8+
plugins: [
9+
{
10+
resolve: `gatsby-source-filesystem`,
11+
options: {
12+
path: `${__dirname}/src/pages`,
13+
name: 'pages'
14+
}
15+
},
16+
{
17+
resolve: `gatsby-transformer-remark`,
18+
options: {
19+
plugins: [
20+
{
21+
resolve: `gatsby-remark-images`,
22+
options: {
23+
maxWidth: 590
24+
}
25+
},
26+
{
27+
resolve: `gatsby-remark-responsive-iframe`,
28+
options: {
29+
wrapperStyle: `margin-bottom: 1.0725rem`
30+
}
31+
},
32+
'gatsby-remark-prismjs',
33+
'gatsby-remark-copy-linked-files',
34+
'gatsby-remark-smartypants'
35+
]
36+
}
37+
},
38+
`gatsby-transformer-sharp`,
39+
`gatsby-plugin-sharp`,
40+
{
41+
resolve: `gatsby-plugin-google-analytics`,
42+
options: {
43+
// trackingId: `ADD YOUR TRACKING ID HERE`,
44+
}
45+
},
46+
`gatsby-plugin-feed`,
47+
`gatsby-plugin-offline`,
48+
`gatsby-plugin-react-helmet`,
49+
{
50+
resolve: 'gatsby-plugin-typography',
51+
options: {
52+
pathToConfigModule: 'src/utils/typography'
53+
}
54+
}
55+
]
56+
};

gatsby-node.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
'use strict';
2+
3+
const path = require('path');
4+
const {createFilePath} = require('gatsby-source-filesystem');
5+
6+
module.exports = {
7+
createPages: ({graphql, boundActionCreators: {createPage}}) => {
8+
return new Promise((resolve, reject) => {
9+
const blogPost = path.resolve('./src/templates/post.js');
10+
11+
resolve(
12+
graphql(
13+
`
14+
{
15+
allMarkdownRemark(sort: { fields: [frontmatter___date], order: DESC }, limit: 1000) {
16+
edges {
17+
node {
18+
fields {
19+
slug
20+
}
21+
frontmatter {
22+
title
23+
}
24+
}
25+
}
26+
}
27+
}
28+
`
29+
).then((result) => {
30+
if (result.errors) {
31+
console.log(result.errors);
32+
reject(result.errors);
33+
}
34+
35+
const posts = result.data.allMarkdownRemark.edges;
36+
37+
posts.forEach((post, index) => {
38+
const previous = index === posts.length - 1 ? null : posts[index + 1].node;
39+
const next = index === 0 ? null : posts[index - 1].node;
40+
41+
createPage({
42+
path: post.node.fields.slug,
43+
component: blogPost,
44+
context: {
45+
slug: post.node.fields.slug,
46+
previous,
47+
next
48+
}
49+
});
50+
});
51+
})
52+
);
53+
});
54+
},
55+
onCreateNode: ({node, boundActionCreators, getNode}) => {
56+
const {createNodeField} = boundActionCreators;
57+
58+
if (node.internal.type === `MarkdownRemark`) {
59+
const value = createFilePath({node, getNode});
60+
61+
createNodeField({
62+
name: `slug`,
63+
node,
64+
value
65+
});
66+
}
67+
}
68+
};

0 commit comments

Comments
 (0)