Skip to content
Write Gatsby redirects to html files with a meta refresh
Branch: master
Clone or download
Latest commit d16a924 Nov 5, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests
.gitignore
.npmignore Don’t ignore source on publish Nov 5, 2018
.prettierrc Update prettier config Nov 5, 2018
.travis.yml Test new nodes Nov 5, 2018
LICENSE
README.md Add Travis CI build Jan 31, 2018
gatsby-node.js Remove Buffer.from call when writing file data Nov 5, 2018
getMetaRedirect.js Move gatsby-node to root Nov 5, 2018
index.js
package.json 1.1.1 Nov 5, 2018

README.md

Travis npm package

gatsby-plugin-meta-redirect

Generates meta redirect html files for redirecting on any static file host.

Install

npm install --save gatsby-plugin-meta-redirect

or

yarn add gatsby-plugin-meta-redirect

How to use

// In your gatsby-config.js
plugins: [
  `gatsby-plugin-meta-redirect` // make sure to put last in the array
];

Redirects

You can create redirects using the createRedirect action.

An example:

createRedirect({ fromPath: '/old-url', toPath: '/new-url', isPermanent: true });
createRedirect({ fromPath: '/url', toPath: '/zn-CH/url', Language: 'zn' });

That will generate the following html files:

/old-url/index.html:

<meta http-equiv="refresh" content="0; URL='/new-url/'" />

and

/url/index.html:

<meta http-equiv="refresh" content="0; URL='/zn-CH/url/'" />
You can’t perform that action at this time.