From 443d36659a3e075899e238107c7af2ff8893bb09 Mon Sep 17 00:00:00 2001 From: Nikolai Berestevich Date: Thu, 20 Jan 2022 11:25:52 +0300 Subject: [PATCH] nikolai.berestevich/fixredirection --- gatsby-node.js | 54 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/gatsby-node.js b/gatsby-node.js index 33ecaeadadf..5187d2f0ef3 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -13,7 +13,7 @@ exports.onCreatePage = ({ page, actions }) => { const is_responsible_trading = /responsible/g.test(page.path) const is_contact_us = /contact_us/g.test(page.path) const is_p2p = /responsible/g.test(page.path) - const is_story = /story/g.test(page.path) + const who_we_are = /who-we-are/g.test(page.path) const is_market = /markets/g.test(page.path) const is_cfds = /cfds/g.test(page.path) @@ -68,7 +68,7 @@ exports.onCreatePage = ({ page, actions }) => { }) } - if (is_story) { + if (who_we_are) { createRedirect({ fromPath: `/about/`, toPath: `/who-we-are/`, @@ -81,6 +81,30 @@ exports.onCreatePage = ({ page, actions }) => { redirectInBrowser: true, isPermanent: true, }) + createRedirect({ + fromPath: `/story/`, + toPath: `/who-we-are/`, + redirectInBrowser: true, + isPermanent: true, + }) + createRedirect({ + fromPath: `/story`, + toPath: `/who-we-are/`, + redirectInBrowser: true, + isPermanent: true, + }) + createRedirect({ + fromPath: `/leadership/`, + toPath: `/who-we-are/`, + redirectInBrowser: true, + isPermanent: true, + }) + createRedirect({ + fromPath: `/leadership`, + toPath: `/who-we-are/`, + redirectInBrowser: true, + isPermanent: true, + }) } if (is_market) { @@ -212,7 +236,7 @@ exports.onCreatePage = ({ page, actions }) => { }) } - if (is_story) { + if (who_we_are) { createRedirect({ fromPath: `/${lang}/about/`, toPath: `/${lang}/who-we-are/`, @@ -225,6 +249,30 @@ exports.onCreatePage = ({ page, actions }) => { redirectInBrowser: true, isPermanent: true, }) + createRedirect({ + fromPath: `/${lang}/story/`, + toPath: `/${lang}/who-we-are/`, + redirectInBrowser: true, + isPermanent: true, + }) + createRedirect({ + fromPath: `/${lang}/story`, + toPath: `/${lang}/who-we-are/`, + redirectInBrowser: true, + isPermanent: true, + }) + createRedirect({ + fromPath: `/${lang}/leadership/`, + toPath: `/${lang}/who-we-are/`, + redirectInBrowser: true, + isPermanent: true, + }) + createRedirect({ + fromPath: `/${lang}/leadership`, + toPath: `/${lang}/who-we-are/`, + redirectInBrowser: true, + isPermanent: true, + }) } if (is_market) {