Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gatsby Migration #402

Merged
merged 140 commits into from Nov 11, 2019
Merged
Changes from 1 commit
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
57a3f25
Initial migration to Gatsby.
ashfurrow Oct 24, 2019
b4d3059
Make it mine.
ashfurrow Oct 24, 2019
d0c6cc9
Updates Prettier settings and runs it.
ashfurrow Oct 24, 2019
9958f2c
More customization.
ashfurrow Oct 24, 2019
1fb2e57
Sets up Typoegraphy and site logos.
ashfurrow Oct 24, 2019
c2724bf
Adds footer links.
ashfurrow Oct 25, 2019
ea1ac1b
Fixes header.
ashfurrow Oct 25, 2019
aaccc61
Makes index page the most recent blog posts.
ashfurrow Oct 25, 2019
0059dc8
Cleans up footer.
ashfurrow Oct 25, 2019
439c251
Customization.
ashfurrow Oct 26, 2019
77bb5c1
Migrates About page.
ashfurrow Oct 26, 2019
f04e11f
Books page.
ashfurrow Oct 26, 2019
9c5013b
Speaking page.
ashfurrow Oct 26, 2019
b012d8b
Improvements for mobile.
ashfurrow Oct 26, 2019
fb418fa
Basics of nav bar.
ashfurrow Oct 26, 2019
e054d2d
More nav bar stuff.
ashfurrow Oct 27, 2019
0a8175d
Remaining nav bar.
ashfurrow Oct 27, 2019
345f4c3
Cleanup.
ashfurrow Oct 27, 2019
0f3a16f
Cleanup.
ashfurrow Oct 27, 2019
5fcb991
Merge branch 'gatsby' of https://github.com/ashfurrow/blog into gatsby
ashfurrow Oct 27, 2019
6c09827
404 page.
ashfurrow Oct 27, 2019
f131087
Blog archive.
ashfurrow Oct 27, 2019
819260a
Cleanup.
ashfurrow Oct 27, 2019
b0bf704
RSS feeds.
ashfurrow Oct 27, 2019
564934b
Netlify deploy config.
ashfurrow Oct 27, 2019
789e975
Removes Travis config.
ashfurrow Oct 27, 2019
546a681
Adds links to feed and search.
ashfurrow Oct 27, 2019
e44cadb
Adds search.
ashfurrow Oct 27, 2019
bfa53a5
Responsive embeds.
ashfurrow Oct 27, 2019
3af083c
Banner attribution link.
ashfurrow Oct 27, 2019
82c5aa6
Start of Portfolio.
ashfurrow Oct 27, 2019
c9eba91
More progress on Portfolio.
ashfurrow Oct 28, 2019
59f252f
More portfolio progress.
ashfurrow Oct 28, 2019
a594d48
Fixes gatsby build.
ashfurrow Oct 28, 2019
274f0aa
Fixes Books styling.
ashfurrow Oct 28, 2019
ffe8988
Fixes design.
ashfurrow Oct 28, 2019
dafe733
Finishes portfolio.
ashfurrow Oct 29, 2019
00f90b7
Fixes netlify redirects.
ashfurrow Oct 29, 2019
4e49827
Deploy trigger.
ashfurrow Oct 29, 2019
99aaa64
Refactors config into TypeScript.
ashfurrow Nov 2, 2019
e6af919
Migrates bootups to Typescript.
ashfurrow Nov 2, 2019
41cff54
Fixes Netlify redirects.
ashfurrow Nov 2, 2019
44c534b
Adds skeleton script and plan.
ashfurrow Nov 2, 2019
f7ebbbf
Initial migration to use MDX.
ashfurrow Nov 2, 2019
4d7b38f
Cleanup from MDX transition.
ashfurrow Nov 2, 2019
6fd56ad
Updates RSS feeds from MDX.
ashfurrow Nov 2, 2019
648e6b0
Fixes ShortCodes.
ashfurrow Nov 3, 2019
81428ae
Next steps.
ashfurrow Nov 3, 2019
c737c37
Progress on YAML translation.
ashfurrow Nov 3, 2019
2b99b4c
Proof-of-concept for new directory structure.
ashfurrow Nov 3, 2019
ae5b7dc
Makes all images Markdown links.
ashfurrow Nov 3, 2019
329a27c
Image moving.
ashfurrow Nov 3, 2019
37c22a0
More progress on images.
ashfurrow Nov 3, 2019
4a4a20c
Supports images.
ashfurrow Nov 3, 2019
9228011
Removes YYYY-MM-DD- from filenames.
ashfurrow Nov 3, 2019
3f21a99
Moves to all-wide YouTube embeds.
ashfurrow Nov 3, 2019
c5ed146
More progress.
ashfurrow Nov 3, 2019
9cb0122
Finishes migration script.
ashfurrow Nov 3, 2019
07950e4
Sets up slugs for new post formats.
ashfurrow Nov 3, 2019
791c892
Migration script improvements.
ashfurrow Nov 6, 2019
3eb0be2
Removes categories and tags, consolidates slug logic.
ashfurrow Nov 6, 2019
e14e844
First pass at previous/next buttons.
ashfurrow Nov 6, 2019
7b6ec17
Finishes PrevNext.
ashfurrow Nov 7, 2019
07cb875
Refactors a lot.
ashfurrow Nov 7, 2019
cb15a0d
GitHub edit links.
ashfurrow Nov 7, 2019
5d65f0b
Wide and Narrow finished.
ashfurrow Nov 7, 2019
d805880
Cleanup.
ashfurrow Nov 7, 2019
bc42ea8
Cleans up migration.
ashfurrow Nov 7, 2019
6621287
First batch of migrated posts.
ashfurrow Nov 7, 2019
dfb3a6f
WOrk on migration.
ashfurrow Nov 7, 2019
1878600
Second migration.
ashfurrow Nov 7, 2019
d81a3f8
Third migration batch.
ashfurrow Nov 7, 2019
c4ded90
Removes sample posts.
ashfurrow Nov 7, 2019
687ae20
Deals with categories and tags.
ashfurrow Nov 7, 2019
ca64d4a
Cleanup.
ashfurrow Nov 7, 2019
013a9f2
Fourth migration.
ashfurrow Nov 7, 2019
5652d2f
Cleanup.
ashfurrow Nov 7, 2019
80b965a
Final pre-Middleman migration.
ashfurrow Nov 7, 2019
7d47d1a
Plan for banner images.
ashfurrow Nov 8, 2019
2135c5d
Banner URLs.
ashfurrow Nov 8, 2019
5c92214
Cleanup.
ashfurrow Nov 8, 2019
ce27778
New migration script with banner support.
ashfurrow Nov 8, 2019
9a8712c
Cleanup.
ashfurrow Nov 8, 2019
2036934
Makes code blocks pretty.
ashfurrow Nov 8, 2019
1a55f6d
Makes Video embeds pretty.
ashfurrow Nov 8, 2019
2fbe072
Fixed SpeakerDeck embeds.
ashfurrow Nov 8, 2019
c7106e1
Fixed search formatting.
ashfurrow Nov 8, 2019
6fc86c2
More migrations. Supports 4x3 SpeakerDeck.
ashfurrow Nov 8, 2019
71efde2
First pass at Minsk migration.
ashfurrow Nov 9, 2019
d9743d8
Finishes Minks migration.
ashfurrow Nov 9, 2019
bf44154
More migration, and Twitter embed support.
ashfurrow Nov 9, 2019
b8834f4
Fixes sort order ambiguity.
ashfurrow Nov 9, 2019
0cd7703
More migration.
ashfurrow Nov 9, 2019
e5b806d
Visual tweaks.
ashfurrow Nov 9, 2019
5eedeac
Yet more migration.
ashfurrow Nov 9, 2019
a6d201f
More migration yay.
ashfurrow Nov 9, 2019
a8f7ffa
Just some of that Saturday night migration!
ashfurrow Nov 9, 2019
6712826
Freaking, migrating these posts! Yeah!
ashfurrow Nov 9, 2019
8044d94
Migrating: the migration commit.
ashfurrow Nov 9, 2019
586081b
Migrating.
ashfurrow Nov 9, 2019
62899fd
Migrate those, those posts!
ashfurrow Nov 9, 2019
8084f7d
Migrating.
ashfurrow Nov 10, 2019
aee4844
Migrating more posts!
ashfurrow Nov 10, 2019
670894a
Migration ongoing.
ashfurrow Nov 10, 2019
fa1930c
Migrating more posts.
ashfurrow Nov 10, 2019
83af1e8
Migrates the remaining normal posts, yay!
ashfurrow Nov 10, 2019
0257084
Migrates learning-from-communities post.
ashfurrow Nov 10, 2019
084e281
Cleans up headers.
ashfurrow Nov 10, 2019
0840ae4
Removes relative URL prefixes from images.
ashfurrow Nov 10, 2019
3abf00c
Renames SpeakerDeck prop.
ashfurrow Nov 10, 2019
1ad5bcf
Cleanup. Parameterizes bottom margin.
ashfurrow Nov 10, 2019
e32c770
Cleanup.
ashfurrow Nov 10, 2019
31d5945
Cleanup (more of).
ashfurrow Nov 10, 2019
5a04ff1
Checks all the SpeakerDeck embeds.
ashfurrow Nov 10, 2019
8c29ea3
Cleans up embeds.
ashfurrow Nov 10, 2019
415c824
Removes spaces from in front of images.
ashfurrow Nov 10, 2019
a24c98b
Fixes feed generation.
ashfurrow Nov 10, 2019
e4a2061
Removes a bunch of Middleman code.
ashfurrow Nov 10, 2019
fef7838
Migrates more stuff! Look at it all!
ashfurrow Nov 10, 2019
c016b36
Landing page and featured posts.
ashfurrow Nov 10, 2019
754d8bf
Polishing design.
ashfurrow Nov 10, 2019
fd97a54
Fixes non-HTTPS images.
ashfurrow Nov 10, 2019
2eda2b2
Fixes import location.
ashfurrow Nov 10, 2019
e3f10d5
Fixes date formatting.
ashfurrow Nov 10, 2019
616ee9c
Fixes social images.
ashfurrow Nov 10, 2019
946fbc6
Initial work towards timeline migration.
ashfurrow Nov 10, 2019
508f381
Makes icons fixed width.
ashfurrow Nov 10, 2019
d0f55b3
Work towards 5-year post.
ashfurrow Nov 10, 2019
c870006
Patches react timeline package.
ashfurrow Nov 10, 2019
810a662
Fixes FOUC on navbar icons.
ashfurrow Nov 10, 2019
04921b5
Timeline proof-of-concept.
ashfurrow Nov 10, 2019
361b2ae
Finishes migrating 5-year post.
ashfurrow Nov 11, 2019
84ccea9
Removes old directory.
ashfurrow Nov 11, 2019
ba19624
Fixes sitemap.
ashfurrow Nov 11, 2019
7c3262b
Fixes a bunch of problems. Hopefully.
ashfurrow Nov 11, 2019
eb8c5e9
Shores up links.
ashfurrow Nov 11, 2019
d9d3596
Fixes spacing issue.
ashfurrow Nov 11, 2019
7e8f768
Fixes footer padding.
ashfurrow Nov 11, 2019
3113869
Fixes FOUC on search page during index download.
ashfurrow Nov 11, 2019
56de6a0
Design tweaks.
ashfurrow Nov 11, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Refactors config into TypeScript.

  • Loading branch information
ashfurrow committed Nov 2, 2019
commit 99aaa6471f22ffc9cc97fa62471b6bdb60edc124
@@ -0,0 +1,53 @@
const path = require('path')
const _ = require('lodash')
const createPages = ({ actions, graphql }) => {
const { createPage } = actions
const postTemplate = path.resolve(`src/templates/Post.tsx`)
return graphql(`
{
allMarkdownRemark(
sort: { order: DESC, fields: [frontmatter___date] }
limit: 10
) {
edges {
node {
excerpt(pruneLength: 250)
html
id
fields {
slug
}
frontmatter {
date
title
category
tags
banner
bannerAttribution
}
timeToRead
}
}
}
}
`).then(result => {
if (result.errors) {
return Promise.reject(result.errors)
}
const posts = result.data.allMarkdownRemark.edges
posts.forEach(({ node }, index) => {
const next = index === 0 ? null : posts[index - 1].node
const prev = index === posts.length - 1 ? null : posts[index + 1].node
createPage({
path: `/blog/${_.kebabCase(node.frontmatter.title)}`,
component: postTemplate,
context: {
slug: _.kebabCase(node.frontmatter.title),
prev,
next
}
})
})
})
}
exports.createPages = createPages
@@ -0,0 +1,12 @@
const _ = require('lodash')
exports.onCreateNode = ({ node, actions }) => {
const { createNodeField } = actions
if (
node.internal.type === 'MarkdownRemark' &&
_.has(node, 'frontmatter') &&
_.has(node.frontmatter, 'title')
) {
const slug = `${_.kebabCase(node.frontmatter.title)}`
createNodeField({ node, name: 'slug', value: slug })
}
}
@@ -0,0 +1,9 @@
const path = require('path')
const onCreateWebpackConfig = ({ stage, actions }) => {
actions.setWebpackConfig({
resolve: {
modules: [path.resolve(__dirname, 'src'), 'node_modules']
}
})
}
exports.onCreateWebpackConfig = onCreateWebpackConfig
@@ -1,171 +1,21 @@
const path = require('path')

const = require('path')
const _ = require('lodash')
const config = require('./config/SiteConfig').default

exports.onCreateNode = ({ node, actions }) => {
const { createNodeField } = actions
if (
node.internal.type === 'MarkdownRemark' &&
_.has(node, 'frontmatter') &&
_.has(node.frontmatter, 'title')
) {
const slug = `${_.kebabCase(node.frontmatter.title)}`
createNodeField({ node, name: 'slug', value: slug })
}
}

const getPostsByType = (posts, classificationType) => {
const postsByType = {}
posts.forEach(({ node }) => {
const nodeClassificationType = node.frontmatter[classificationType]
if (nodeClassificationType) {
if (_.isArray(nodeClassificationType)) {
nodeClassificationType.forEach(name => {
if (!_.has(postsByType, name)) {
postsByType[name] = []
}
postsByType[name].push(node)
})
} else {
const name = nodeClassificationType
if (!postsByType[name]) {
postsByType[name] = []
}
postsByType[name].push(node)
}
}
})
return postsByType
}

const createClassificationPages = ({
createPage,
posts,
postsPerPage,
numPages
}) => {
const classifications = [
{
singularName: 'category',
pluralName: 'categories',
template: {
part: path.resolve(`src/templates/Category.tsx`),
all: path.resolve(`src/templates/AllCategory.tsx`)
},
postsByClassificationNames: getPostsByType(posts, 'category')
},
{
singularName: 'tag',
pluralName: 'tags',
template: {
part: path.resolve(`src/templates/Tag.tsx`),
all: path.resolve(`src/templates/AllTag.tsx`)
},
postsByClassificationNames: getPostsByType(posts, 'tags')
}
]

classifications.forEach(classification => {
const names = Object.keys(classification.postsByClassificationNames)

createPage({
path: _.kebabCase(`/${classification.pluralName}`),
component: classification.template.all,
context: {
[`${classification.pluralName}`]: names.sort()
}
})

names.forEach(name => {
const postsByName = classification.postsByClassificationNames[name]
createPage({
path: `/${classification.pluralName}/${_.kebabCase(name)}`,
component: classification.template.part,
context: {
posts: postsByName,
[`${classification.singularName}Name`]: name
}
})
})
})
}
const { onCreateWebpackConfig } = require("./bootup/onCreateWebpackConfig")
const { onCreateNode } = require('./bootup/onCreateNode')
const { createPages } = require("./bootup/createPages")

exports.onCreateWebpackConfig = ({ stage, actions }) => {
actions.setWebpackConfig({
resolve: {
modules: [path.resolve(__dirname, 'src'), 'node_modules']
}
})
/** @type { import("gatsby").GatsbyNode } */
const gatsbyNode = {
onCreateNode,
createPages,
onCreateWebpackConfig
}
module.exports = gatsbyNode

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

const postTemplate = path.resolve(`src/templates/Post.tsx`)

return graphql(`
{
allMarkdownRemark(
sort: { order: DESC, fields: [frontmatter___date] }
limit: 10
) {
edges {
node {
excerpt(pruneLength: 250)
html
id
fields {
slug
}
frontmatter {
date
title
category
tags
banner
bannerAttribution
}
timeToRead
}
}
}
}
`).then(result => {
if (result.errors) {
return Promise.reject(result.errors)
}
const posts = result.data.allMarkdownRemark.edges

// TODO: Make this the archives page
// Array.from({ length: numPages })
// .forEach((_, i) => {
// createPage({
// path: i === 0 ? `/blog` : `/blog/${i + 1}`,
// component: path.resolve('./src/templates/Blog.tsx'),
// context: {
// limit: postsPerPage,
// skip: i * postsPerPage,
// totalPages: numPages,
// currentPage: i + 1
// },
// });
// });

// createClassificationPages({ createPage, posts, postsPerPage, numPages })

posts.forEach(({ node }, index) => {
const next = index === 0 ? null : posts[index - 1].node
const prev = index === posts.length - 1 ? null : posts[index + 1].node

createPage({
path: `/blog/${_.kebabCase(node.frontmatter.title)}`,
component: postTemplate,
context: {
slug: _.kebabCase(node.frontmatter.title),
prev,
next
}
})
})
})
}
/*
TODO:
Gatsby launch.json for VSCode
*/
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.