gatsby
5.16.1 · 10 Feb 2026MIT252.9k / weekRepositoryHomepagenpmAtom feed
Your version
0.12.48 is the newest release of 0.12.x.
Security
1 advisory affects 0.12.31; 4.25.7 fixes them
- ModerateGatsby develop server has Local File Inclusion vulnerabilityGHSA-c6f8-8r25-c4gc · 9 Jun 2023Fixed in 4.25.7
Release note
@scottyeck and @stevensurgnier have been working on a way to add client-side redirects and remove trailing slashes from routes and towards that aim added a new browser lifecycle API modifyRoutes in #657
Some examples they came up with.
Add redirects:
exports.modifyRoutes = routes => {
const redirects = [
{
path: '/cat',
onEnter: (nextState, replace) => replace('/dog?utm_campaign=cat')
}
];
const childRoutesLength = routes.childRoutes.length;
const childRoutesButLast = routes.childRoutes.slice(0, childRoutesLength - 1);
const childRoutesLast = routes.childRoutes[childRoutesLength - 1];
routes.childRoutes = childRoutesButLast.concat(redirects).concat([childRoutesLast]);
return routes;
};Remove trailing slashes:
exports.modifyRoutes = routes => {
routes.childRoutes.forEach(route => route.path = route.path.replace(/\/$/, ''));
return routes;
};