Skip to content

Commit

Permalink
Fixed blog.html redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
bvaughn committed Sep 21, 2017
1 parent 8f6bfc2 commit 7ac3f17
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 71 deletions.
1 change: 1 addition & 0 deletions www/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {
},
plugins: [
'gatsby-transformer-authors-yaml',
'gatsby-plugin-netlify',
'gatsby-plugin-glamor',
'gatsby-plugin-react-next',
{
Expand Down
14 changes: 8 additions & 6 deletions www/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ exports.modifyWebpackConfig = ({ config, stage }) => {
};

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

const blogTemplate = resolve('./src/templates/blog.js');
const communityTemplate = resolve('./src/templates/community.js');
Expand Down Expand Up @@ -129,10 +129,7 @@ exports.createPages = async ({graphql, boundActionCreators}) => {
}
});

/* TODO Register '/blog.html' redirect to most recent blog entry.
* And delete redundant 'pages/blog.html.js'
* github.com/gatsbyjs/gatsby/pull/1068
const mostRecentBlogMarkdown = await graphql(`
const newestBlogEntry = await graphql(`
{
allMarkdownRemark(
limit: 1,
Expand All @@ -149,7 +146,12 @@ exports.createPages = async ({graphql, boundActionCreators}) => {
}
}
`);
*/

// Blog landing page should always show the most recent blog entry.
createRedirect({
fromPath: '/blog.html',
toPath: newestBlogEntry.data.allMarkdownRemark.edges[0].node.fields.slug
});
};

// Parse date information out of blog post filename.
Expand Down
1 change: 1 addition & 0 deletions www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"gatsby-plugin-glamor": "^1.6.4",
"gatsby-plugin-google-analytics": "^1.0.4",
"gatsby-plugin-manifest": "^1.0.4",
"gatsby-plugin-netlify": "^1.0.2",
"gatsby-plugin-offline": "^1.0.4",
"gatsby-plugin-react-helmet": "^1.0.3",
"gatsby-plugin-react-next": "^1.0.3",
Expand Down
54 changes: 0 additions & 54 deletions www/src/pages/blog.html.js

This file was deleted.

63 changes: 52 additions & 11 deletions www/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,14 @@ chalk@1.1.3, chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3:
strip-ansi "^3.0.0"
supports-color "^2.0.0"

chalk@^2.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.1.0.tgz#ac5becf14fa21b99c6c92ca7a7d7cfd5b17e743e"
dependencies:
ansi-styles "^3.1.0"
escape-string-regexp "^1.0.5"
supports-color "^4.0.0"

chalk@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.0.1.tgz#dbec49436d2ae15f536114e76d14656cdbc0f44d"
Expand Down Expand Up @@ -3366,6 +3374,15 @@ gatsby-plugin-manifest@^1.0.4:
babel-runtime "^6.26.0"
bluebird "^3.5.0"

gatsby-plugin-netlify@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/gatsby-plugin-netlify/-/gatsby-plugin-netlify-1.0.2.tgz#4c84287efda9bb36ffd5c10bfb8fe135fc51929e"
dependencies:
babel-runtime "^6.26.0"
lodash "^4.17.4"
pify "3.0.0"
webpack-assets-manifest "^1.0.0"

gatsby-plugin-offline@^1.0.4:
version "1.0.9"
resolved "https://registry.yarnpkg.com/gatsby-plugin-offline/-/gatsby-plugin-offline-1.0.9.tgz#5d5879caf81a6e762984341f6eba765818d92320"
Expand Down Expand Up @@ -3488,8 +3505,8 @@ gatsby-source-filesystem@^1.4.4:
slash "^1.0.0"

gatsby-transformer-remark@^1.7.2:
version "1.7.9"
resolved "https://registry.yarnpkg.com/gatsby-transformer-remark/-/gatsby-transformer-remark-1.7.9.tgz#fe1d2867aca54c62e9bef33c73cc19e2a90674e0"
version "1.7.10"
resolved "https://registry.yarnpkg.com/gatsby-transformer-remark/-/gatsby-transformer-remark-1.7.10.tgz#0e0df5495a189b0db601ca73c48c66b70e6055be"
dependencies:
babel-runtime "^6.26.0"
bluebird "^3.5.0"
Expand All @@ -3514,8 +3531,8 @@ gatsby-transformer-sharp@^1.6.1:
image-size "^0.6.0"

gatsby@^1.9.9:
version "1.9.40"
resolved "https://registry.yarnpkg.com/gatsby/-/gatsby-1.9.40.tgz#e4c713ec9ad849d4f5e455e595f941abd5a05ede"
version "1.9.42"
resolved "https://registry.yarnpkg.com/gatsby/-/gatsby-1.9.42.tgz#6792442e9b7f69e7d2b3e76b63b468de097c61c6"
dependencies:
async "^2.1.2"
babel-code-frame "^6.22.0"
Expand Down Expand Up @@ -5139,6 +5156,14 @@ lodash.foreach@^4.3.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.foreach/-/lodash.foreach-4.5.0.tgz#1a6a35eace401280c7f06dddec35165ab27e3e53"

lodash.get@^4.0:
version "4.4.2"
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"

lodash.has@^4.0:
version "4.5.2"
resolved "https://registry.yarnpkg.com/lodash.has/-/lodash.has-4.5.2.tgz#d19f4dc1095058cccbe2b0cdf4ee0fe4aa37c862"

lodash.isarguments@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a"
Expand Down Expand Up @@ -5167,6 +5192,10 @@ lodash.keys@^3.0.0:
lodash.isarguments "^3.0.0"
lodash.isarray "^3.0.0"

lodash.keys@^4.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-4.2.0.tgz#a08602ac12e4fb83f91fc1fb7a360a4d9ba35205"

lodash.map@^4.4.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.map/-/lodash.map-4.6.0.tgz#771ec7839e3473d9c4cde28b19394c3562f4f6d3"
Expand All @@ -5179,7 +5208,7 @@ lodash.memoize@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"

lodash.merge@^4.4.0:
lodash.merge@^4.0, lodash.merge@^4.4.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.0.tgz#69884ba144ac33fe699737a6086deffadd0f89c5"

Expand All @@ -5195,7 +5224,7 @@ lodash.padstart@^4.1.0:
version "4.6.1"
resolved "https://registry.yarnpkg.com/lodash.padstart/-/lodash.padstart-4.6.1.tgz#d2e3eebff0d9d39ad50f5cbd1b52a7bce6bb611b"

lodash.pick@^4.2.1:
lodash.pick@^4.0, lodash.pick@^4.2.1:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3"

Expand Down Expand Up @@ -5604,7 +5633,7 @@ mixin-deep@^1.1.3:
for-in "^1.0.2"
is-extendable "^0.1.1"

"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1:
"mkdirp@>=0.5 0", mkdirp@^0.5, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
dependencies:
Expand Down Expand Up @@ -6219,14 +6248,14 @@ pez@1.x.x:
hoek "2.x.x"
nigel "1.x.x"

pify@3.0.0, pify@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176"

pify@^2.0.0, pify@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"

pify@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176"

pinkie-promise@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa"
Expand Down Expand Up @@ -9053,6 +9082,18 @@ watchpack@^0.2.1:
chokidar "^1.0.0"
graceful-fs "^4.1.2"

webpack-assets-manifest@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/webpack-assets-manifest/-/webpack-assets-manifest-1.0.0.tgz#54a1bc4036e2eed2b3ce1fd6a7e31c09be99538a"
dependencies:
chalk "^2.0"
lodash.get "^4.0"
lodash.has "^4.0"
lodash.keys "^4.0"
lodash.merge "^4.0"
lodash.pick "^4.0"
mkdirp "^0.5"

webpack-configurator@^0.3.0:
version "0.3.1"
resolved "https://registry.yarnpkg.com/webpack-configurator/-/webpack-configurator-0.3.1.tgz#d16802afa674101a0cbfa6fc344d415c9649540b"
Expand Down

0 comments on commit 7ac3f17

Please sign in to comment.