From 78a87304c0aa19068c285121850d4b653c8d33a6 Mon Sep 17 00:00:00 2001 From: Peter Doherty Date: Tue, 19 Feb 2019 15:44:57 -0500 Subject: [PATCH 1/5] feature/prevent-navigation - first pass at config option to prevent navigation when gatsby is being used as a single/static page generator --- .../.eslintrc.json | 8 +++++++ .../.gitignore | 3 +++ .../README.md | 13 +++++++++++ .../gatsby-config.js | 3 +++ .../package.json | 22 +++++++++++++++++++ .../src/pages/a.js | 5 +++++ .../src/pages/b.js | 5 +++++ .../src/pages/c.js | 5 +++++ .../src/pages/index.js | 21 ++++++++++++++++++ packages/gatsby/cache-dir/.eslintrc.json | 3 ++- .../cache-dir/__tests__/static-entry.js | 1 + packages/gatsby/cache-dir/production-app.js | 2 ++ packages/gatsby/cache-dir/static-entry.js | 1 + packages/gatsby/src/joi-schemas/joi.js | 1 + packages/gatsby/src/utils/eslint-config.js | 1 + 15 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/.eslintrc.json create mode 100644 examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/.gitignore create mode 100644 examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/README.md create mode 100644 examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/gatsby-config.js create mode 100644 examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/package.json create mode 100644 examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/a.js create mode 100644 examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/b.js create mode 100644 examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/c.js create mode 100644 examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/index.js diff --git a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/.eslintrc.json b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/.eslintrc.json new file mode 100644 index 0000000000000..aadde9c0aa03d --- /dev/null +++ b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/.eslintrc.json @@ -0,0 +1,8 @@ +{ + "env": { + "browser": true + }, + "globals": { + "graphql": false + } +} \ No newline at end of file diff --git a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/.gitignore b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/.gitignore new file mode 100644 index 0000000000000..8f5b35a4a9cbc --- /dev/null +++ b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/.gitignore @@ -0,0 +1,3 @@ +public +.cache +node_modules diff --git a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/README.md b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/README.md new file mode 100644 index 0000000000000..74bd1c713e758 --- /dev/null +++ b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/README.md @@ -0,0 +1,13 @@ +# using-path-prefix + +To test this example site locally run the following commands from this directory + +```bash +gatsby build --prefix-paths +cd public +mkdir prefix +mv * prefix # This will cause an error but you can ignore it +cd .. +gatsby serve +# Open the served site at localhost:9000/prefix/ +``` diff --git a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/gatsby-config.js b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/gatsby-config.js new file mode 100644 index 0000000000000..74458e345e715 --- /dev/null +++ b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/gatsby-config.js @@ -0,0 +1,3 @@ +module.exports = { + disableAllRedirectsBecasueImUsingGatsbyAsAStaticPageGenerator: true, +} diff --git a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/package.json b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/package.json new file mode 100644 index 0000000000000..92b1610cd42d1 --- /dev/null +++ b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/package.json @@ -0,0 +1,22 @@ +{ + "name": "using-path-prefix", + "private": true, + "description": "Gatsby example site using using-path-prefix", + "author": "Kyle Mathews <mathews.kyle@gmail.com>", + "dependencies": { + "gatsby": "../packages", + "react": "^16.4.0", + "react-dom": "^16.4.0" + }, + "keywords": [ + "gatsby" + ], + "license": "MIT", + "main": "n/a", + "scripts": { + "develop": "gatsby develop", + "build": "gatsby build", + "start": "npm run develop", + "serve": "gatsby serve" + } +} diff --git a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/a.js b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/a.js new file mode 100644 index 0000000000000..bafb75f9991ac --- /dev/null +++ b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/a.js @@ -0,0 +1,5 @@ +import React from "react" + +const A = () =>

A

+ +export default A diff --git a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/b.js b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/b.js new file mode 100644 index 0000000000000..6b15e3bd526e5 --- /dev/null +++ b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/b.js @@ -0,0 +1,5 @@ +import React from "react" + +const B = () =>

B

+ +export default B diff --git a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/c.js b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/c.js new file mode 100644 index 0000000000000..7e39f24fd0915 --- /dev/null +++ b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/c.js @@ -0,0 +1,5 @@ +import React from "react" + +const C = () =>

C

+ +export default C diff --git a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/index.js b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/index.js new file mode 100644 index 0000000000000..07fe01b793edd --- /dev/null +++ b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/index.js @@ -0,0 +1,21 @@ +import React from "react" +import { Link } from "gatsby" + +const Home = () => ( +
+

Using prefixed paths

+ +
+) + +export default Home diff --git a/packages/gatsby/cache-dir/.eslintrc.json b/packages/gatsby/cache-dir/.eslintrc.json index 9352bcdc0dc2e..938709b017bab 100644 --- a/packages/gatsby/cache-dir/.eslintrc.json +++ b/packages/gatsby/cache-dir/.eslintrc.json @@ -4,6 +4,7 @@ }, "globals": { "__PATH_PREFIX__": false, + "__DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR__": false, "___emitter": false } -} \ No newline at end of file +} diff --git a/packages/gatsby/cache-dir/__tests__/static-entry.js b/packages/gatsby/cache-dir/__tests__/static-entry.js index 03d857d15a1de..f35478dd963d8 100644 --- a/packages/gatsby/cache-dir/__tests__/static-entry.js +++ b/packages/gatsby/cache-dir/__tests__/static-entry.js @@ -136,6 +136,7 @@ describe(`develop-static-entry`, () => { describe(`static-entry`, () => { beforeEach(() => { global.__PATH_PREFIX__ = `` + global.__DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR__ = `` }) test(`onPreRenderHTML can be used to replace headComponents`, done => { diff --git a/packages/gatsby/cache-dir/production-app.js b/packages/gatsby/cache-dir/production-app.js index 0e174ab30376e..aba69300d4503 100644 --- a/packages/gatsby/cache-dir/production-app.js +++ b/packages/gatsby/cache-dir/production-app.js @@ -65,6 +65,8 @@ apiRunnerAsync(`onClientEntry`).then(() => { if ( // Make sure the window.page object is defined page && + // Prevent navigation when acting as a single/static page generator + !__DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR__ && // The canonical path doesn't match the actual path (i.e. the address bar) __PATH_PREFIX__ + page.path !== browserLoc.pathname && // ...and if matchPage is specified, it also doesn't match the actual path diff --git a/packages/gatsby/cache-dir/static-entry.js b/packages/gatsby/cache-dir/static-entry.js index 3e0cb708ba184..77e46a18e637d 100644 --- a/packages/gatsby/cache-dir/static-entry.js +++ b/packages/gatsby/cache-dir/static-entry.js @@ -376,6 +376,7 @@ export default (pagePath, callback) => { replacePostBodyComponents, pathname: pagePath, pathPrefix: __PATH_PREFIX__, + disableAllRedirectsBecasueImUsingGatsbyAsAStaticPageGenerator: __DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR__, }) const html = `${renderToStaticMarkup( diff --git a/packages/gatsby/src/joi-schemas/joi.js b/packages/gatsby/src/joi-schemas/joi.js index 7a5d1f97a69df..322cdd337f02a 100644 --- a/packages/gatsby/src/joi-schemas/joi.js +++ b/packages/gatsby/src/joi-schemas/joi.js @@ -5,6 +5,7 @@ export const gatsbyConfigSchema = Joi.object().keys({ polyfill: Joi.boolean(), siteMetadata: Joi.object(), pathPrefix: Joi.string(), + disableAllRedirectsBecasueImUsingGatsbyAsAStaticPageGenerator: Joi.boolean(), mapping: Joi.object(), plugins: Joi.array(), proxy: Joi.object().keys({ diff --git a/packages/gatsby/src/utils/eslint-config.js b/packages/gatsby/src/utils/eslint-config.js index 0f5136124a040..28158f2a637ea 100644 --- a/packages/gatsby/src/utils/eslint-config.js +++ b/packages/gatsby/src/utils/eslint-config.js @@ -6,6 +6,7 @@ module.exports = schema => { baseConfig: { globals: { graphql: true, + __DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR__: false, __PATH_PREFIX__: true, }, extends: `react-app`, From c8b931446065628e826e7e880b8cfd3294499e1b Mon Sep 17 00:00:00 2001 From: Peter Doherty Date: Tue, 19 Feb 2019 17:28:10 -0500 Subject: [PATCH 2/5] feature/prevent-navigation - wire up new configuration option; include working example application using new config option --- .../README.md | 24 +++++++++++++------ .../package.json | 2 +- packages/gatsby/src/utils/webpack.config.js | 2 ++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/README.md b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/README.md index 74bd1c713e758..559d94dd4f60c 100644 --- a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/README.md +++ b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/README.md @@ -1,13 +1,23 @@ -# using-path-prefix +# using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR To test this example site locally run the following commands from this directory ```bash -gatsby build --prefix-paths +npm run build cd public -mkdir prefix -mv * prefix # This will cause an error but you can ignore it -cd .. -gatsby serve -# Open the served site at localhost:9000/prefix/ +python -m SimpleHTTPServer 9000 ``` + +Assuming that `disableAllRedirectsBecasueImUsingGatsbyAsAStaticPageGenerator` is +still set to `true` in gatsby-config.js, navigate to +http://localhost:9000/index.html in a web browser and notice that the URL does +not change to http://localhost:9000, which is Gatsby's default behavior. + +This behavior is desirable when: + +- embedding a Gatsby application in a host web page +- serving a Gatsby application via an Nginx alias or similar +- serving a Gatsby application from an S3 sub-bucket or similar + +Please submit PRs containing additional use-cases so other users are able to find +out about this feature in the future. diff --git a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/package.json b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/package.json index 92b1610cd42d1..46f1c09f0b8ff 100644 --- a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/package.json +++ b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/package.json @@ -4,7 +4,7 @@ "description": "Gatsby example site using using-path-prefix", "author": "Kyle Mathews <mathews.kyle@gmail.com>", "dependencies": { - "gatsby": "../packages", + "gatsby": "../../packages/gatsby", "react": "^16.4.0", "react-dom": "^16.4.0" }, diff --git a/packages/gatsby/src/utils/webpack.config.js b/packages/gatsby/src/utils/webpack.config.js index dd7ca1eb5f175..70c5057dd8cd0 100644 --- a/packages/gatsby/src/utils/webpack.config.js +++ b/packages/gatsby/src/utils/webpack.config.js @@ -181,6 +181,8 @@ module.exports = async ( // optimizations for React) and what the link prefix is (__PATH_PREFIX__). plugins.define({ ...processEnv(stage, `development`), + __DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR__: store.getState() + .config.disableAllRedirectsBecasueImUsingGatsbyAsAStaticPageGenerator, __PATH_PREFIX__: JSON.stringify( program.prefixPaths ? store.getState().config.pathPrefix : `` ), From 098ef9cc9884d185ebf0b708890d4b83da5f6f0f Mon Sep 17 00:00:00 2001 From: Peter Doherty Date: Tue, 19 Feb 2019 21:42:37 -0500 Subject: [PATCH 3/5] feature/prevent-navigation - use sensible global.__DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR__ value in __tests__/static-entry.js --- packages/gatsby/cache-dir/__tests__/static-entry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gatsby/cache-dir/__tests__/static-entry.js b/packages/gatsby/cache-dir/__tests__/static-entry.js index f35478dd963d8..9076cb8fa84c5 100644 --- a/packages/gatsby/cache-dir/__tests__/static-entry.js +++ b/packages/gatsby/cache-dir/__tests__/static-entry.js @@ -136,7 +136,7 @@ describe(`develop-static-entry`, () => { describe(`static-entry`, () => { beforeEach(() => { global.__PATH_PREFIX__ = `` - global.__DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR__ = `` + global.__DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR__ = false }) test(`onPreRenderHTML can be used to replace headComponents`, done => { From 6cf276bca3187b56206d8b1b05b24b1859f31dee Mon Sep 17 00:00:00 2001 From: Peter Doherty Date: Tue, 19 Feb 2019 23:17:09 -0500 Subject: [PATCH 4/5] feature/prevent-navigation - reduce example surface size --- .../src/pages/a.js | 5 ----- .../src/pages/b.js | 5 ----- .../src/pages/c.js | 5 ----- .../src/pages/index.js | 21 +++++++------------ 4 files changed, 8 insertions(+), 28 deletions(-) delete mode 100644 examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/a.js delete mode 100644 examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/b.js delete mode 100644 examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/c.js diff --git a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/a.js b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/a.js deleted file mode 100644 index bafb75f9991ac..0000000000000 --- a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/a.js +++ /dev/null @@ -1,5 +0,0 @@ -import React from "react" - -const A = () =>

A

- -export default A diff --git a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/b.js b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/b.js deleted file mode 100644 index 6b15e3bd526e5..0000000000000 --- a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/b.js +++ /dev/null @@ -1,5 +0,0 @@ -import React from "react" - -const B = () =>

B

- -export default B diff --git a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/c.js b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/c.js deleted file mode 100644 index 7e39f24fd0915..0000000000000 --- a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/c.js +++ /dev/null @@ -1,5 +0,0 @@ -import React from "react" - -const C = () =>

C

- -export default C diff --git a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/index.js b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/index.js index 07fe01b793edd..7a72e3cf2d56e 100644 --- a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/index.js +++ b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/index.js @@ -1,20 +1,15 @@ import React from "react" -import { Link } from "gatsby" const Home = () => (
-

Using prefixed paths

-
    -
  • - A -
  • -
  • - B -
  • -
  • - C -
  • -
+

+ By default, Gatsby will change http://localhost:9000/index.html to + http://localhost:9000. +

+

+ setting `disableAllRedirectsBecasueImUsingGatsbyAsAStaticPageGenerator: + true` will prevent this or any similar behavior from happening. +

) From 7d95ff8bc2ea6a37d9f832dd621ee5303ac520a2 Mon Sep 17 00:00:00 2001 From: Peter Doherty Date: Tue, 19 Feb 2019 23:29:21 -0500 Subject: [PATCH 5/5] feature/prevent-navigation - text changes in example --- .../README.md | 3 +-- .../package.json | 4 ++-- .../src/pages/index.js | 7 ++++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/README.md b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/README.md index 559d94dd4f60c..662091ab57d63 100644 --- a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/README.md +++ b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/README.md @@ -19,5 +19,4 @@ This behavior is desirable when: - serving a Gatsby application via an Nginx alias or similar - serving a Gatsby application from an S3 sub-bucket or similar -Please submit PRs containing additional use-cases so other users are able to find -out about this feature in the future. +PRs containing additional use-cases would be most welcome. diff --git a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/package.json b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/package.json index 46f1c09f0b8ff..75ee6e58ca34a 100644 --- a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/package.json +++ b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/package.json @@ -1,8 +1,8 @@ { "name": "using-path-prefix", "private": true, - "description": "Gatsby example site using using-path-prefix", - "author": "Kyle Mathews <mathews.kyle@gmail.com>", + "description": "Gatsby example site using disableAllRedirectsBecasueImUsingGatsbyAsAStaticPageGenerator config option", + "author": "pdoherty@protonmail.com", "dependencies": { "gatsby": "../../packages/gatsby", "react": "^16.4.0", diff --git a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/index.js b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/index.js index 7a72e3cf2d56e..18810cf7dbe65 100644 --- a/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/index.js +++ b/examples/using-DISABLE_ALL_REDIRECTS_BECASUE_IM_USING_GATSBY_AS_A_STATIC_PAGE_GENERATOR/src/pages/index.js @@ -4,11 +4,12 @@ const Home = () => (

By default, Gatsby will change http://localhost:9000/index.html to - http://localhost:9000. + http://localhost:9000 in order to make the canonical path match the URL.

- setting `disableAllRedirectsBecasueImUsingGatsbyAsAStaticPageGenerator: - true` will prevent this or any similar behavior from happening. + The default behavior is undesireable in many circumstances (see README.md) + and the `disableAllRedirectsBecasueImUsingGatsbyAsAStaticPageGenerator` + configuration option can be used to disable it.

)