48
loading...
This website collects cookies to deliver better user experience
/path/a
in their browser301 Moved Permanently
, Location: /path/b
header/path/b
gatsby-node.js
as javascript. It felt like a code smell to me...async function processRedirects({ actions, reporter }) {
const lineReader = readline.createInterface({
// using the same file name as Netlify
input: fs.createReadStream('_redirects'),
});
const { createRedirect } = actions;
// process every line and define the path redirect
lineReader.on('line', (line) => {
const [fromPath, toPath] = line.split(/\s+/);
console.log(`Redirecting ${fromPath} to ${toPath}`);
createRedirect({ fromPath, toPath });
});
}
exports.createPages = async ({ graphql, actions, reporter }) => {
...
await processRedirects({ actions, reporter });
};
/tag
path to /tags
./tag /tags