From 31c1d12126e73d1a6098ad27596f24621dba9220 Mon Sep 17 00:00:00 2001 From: Carla Goncalves Date: Wed, 15 Oct 2025 11:30:31 +0100 Subject: [PATCH 1/6] Add redirects for pages --- gatsby-config.ts | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/gatsby-config.ts b/gatsby-config.ts index a2008727..a1d272f9 100644 --- a/gatsby-config.ts +++ b/gatsby-config.ts @@ -120,6 +120,44 @@ let plugins: any = [ __key: 'pages', }, 'gatsby-plugin-meta-redirect', + { + resolve: 'gatsby-plugin-redirect', + options: { + redirects: [ + { + fromPath: '/postgresql/setting-up-a-local-postgresql-database', + toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/setting-up-a-local-postgresql-database', + isPermanent: false, + }, + { + fromPath: '/postgresql/introduction-to-data-types', + toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/introduction-to-data-types', + isPermanent: false, + }, + { + fromPath: '/postgresql/date-type', + toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/date-types', + isPermanent: false, + }, + { + fromPath: '/postgresql/connecting-to-postgresql-databases', + toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/connecting-to-postgresql-databases', + isPermanent: false, + }, + { + fromPath: '/postgresql/short-guides/connection-uris', + toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/connection-uris', + isPermanent: false, + }, + { + fromPath: "/intro/database-glossary", + toPath: "https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/database-glossary", + isPermanent: false, + } + // Add more redirects as needed + ], + }, + }, 'gatsby-plugin-page-list', ] From 83119aca225451c2ca3bbacebb0a600c3fb1857e Mon Sep 17 00:00:00 2001 From: Carla Goncalves Date: Wed, 15 Oct 2025 11:33:05 +0100 Subject: [PATCH 2/6] add in correct file --- config.ts | 33 ++++++++++++++++++++++++++++++++- gatsby-config.ts | 38 -------------------------------------- 2 files changed, 32 insertions(+), 39 deletions(-) diff --git a/config.ts b/config.ts index d5814d9e..178526c3 100644 --- a/config.ts +++ b/config.ts @@ -3,7 +3,38 @@ const siteConfig = { pathPrefix: '/dataguide', siteUrl: 'https://www.prisma.io', }, - redirects: [], + redirects: [ + { + fromPath: '/postgresql/setting-up-a-local-postgresql-database', + toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/setting-up-a-local-postgresql-database', + isPermanent: false, + }, + { + fromPath: '/postgresql/introduction-to-data-types', + toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/introduction-to-data-types', + isPermanent: false, + }, + { + fromPath: '/postgresql/date-type', + toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/date-types', + isPermanent: false, + }, + { + fromPath: '/postgresql/connecting-to-postgresql-databases', + toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/connecting-to-postgresql-databases', + isPermanent: false, + }, + { + fromPath: '/postgresql/short-guides/connection-uris', + toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/connection-uris', + isPermanent: false, + }, + { + fromPath: "/intro/database-glossary", + toPath: "https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/database-glossary", + isPermanent: false, + } + ], header: { logoLink: '/', title: "Prisma's Data Guide - Educational articles to make databases more approachable", diff --git a/gatsby-config.ts b/gatsby-config.ts index a1d272f9..a2008727 100644 --- a/gatsby-config.ts +++ b/gatsby-config.ts @@ -120,44 +120,6 @@ let plugins: any = [ __key: 'pages', }, 'gatsby-plugin-meta-redirect', - { - resolve: 'gatsby-plugin-redirect', - options: { - redirects: [ - { - fromPath: '/postgresql/setting-up-a-local-postgresql-database', - toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/setting-up-a-local-postgresql-database', - isPermanent: false, - }, - { - fromPath: '/postgresql/introduction-to-data-types', - toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/introduction-to-data-types', - isPermanent: false, - }, - { - fromPath: '/postgresql/date-type', - toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/date-types', - isPermanent: false, - }, - { - fromPath: '/postgresql/connecting-to-postgresql-databases', - toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/connecting-to-postgresql-databases', - isPermanent: false, - }, - { - fromPath: '/postgresql/short-guides/connection-uris', - toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/connection-uris', - isPermanent: false, - }, - { - fromPath: "/intro/database-glossary", - toPath: "https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/database-glossary", - isPermanent: false, - } - // Add more redirects as needed - ], - }, - }, 'gatsby-plugin-page-list', ] From 166819632525e68017b918fae40d5ccf620fa1c5 Mon Sep 17 00:00:00 2001 From: Carla Goncalves Date: Wed, 15 Oct 2025 11:35:56 +0100 Subject: [PATCH 3/6] Update frompath --- config.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config.ts b/config.ts index 178526c3..e816b45a 100644 --- a/config.ts +++ b/config.ts @@ -5,32 +5,32 @@ const siteConfig = { }, redirects: [ { - fromPath: '/postgresql/setting-up-a-local-postgresql-database', + fromPath: '/dataguide/postgresql/setting-up-a-local-postgresql-database', toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/setting-up-a-local-postgresql-database', isPermanent: false, }, { - fromPath: '/postgresql/introduction-to-data-types', + fromPath: '/dataguide/postgresql/introduction-to-data-types', toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/introduction-to-data-types', isPermanent: false, }, { - fromPath: '/postgresql/date-type', + fromPath: '/dataguide/postgresql/date-type', toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/date-types', isPermanent: false, }, { - fromPath: '/postgresql/connecting-to-postgresql-databases', + fromPath: '/dataguide/postgresql/connecting-to-postgresql-databases', toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/connecting-to-postgresql-databases', isPermanent: false, }, { - fromPath: '/postgresql/short-guides/connection-uris', + fromPath: '/dataguide/postgresql/short-guides/connection-uris', toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/connection-uris', isPermanent: false, }, { - fromPath: "/intro/database-glossary", + fromPath: "/dataguide/intro/database-glossary", toPath: "https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/database-glossary", isPermanent: false, } From 07ee3914b617036c6e8d65295a8a6fa2b3bb11f2 Mon Sep 17 00:00:00 2001 From: Carla Goncalves Date: Wed, 15 Oct 2025 11:37:59 +0100 Subject: [PATCH 4/6] Update gatsby-node --- gatsby-node.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gatsby-node.ts b/gatsby-node.ts index c94c5122..fda0e001 100644 --- a/gatsby-node.ts +++ b/gatsby-node.ts @@ -1,3 +1,5 @@ +import siteConfig from "./config" + const path = require('path') exports.onCreateNode = ({ node, getNode, actions }: any) => { @@ -28,8 +30,13 @@ exports.onCreateNode = ({ node, getNode, actions }: any) => { } exports.createPages = async ({ graphql, actions, reporter }: any) => { - const { createPage } = actions + const { createPage, createRedirect } = actions + + const redirects = siteConfig.redirects + redirects.forEach(redirect => { + createRedirect(redirect) + }); const result = await graphql(` query { allMdx { From 47635b6f054a1465e796eae6dda3139ff067fba2 Mon Sep 17 00:00:00 2001 From: Carla Goncalves Date: Wed, 15 Oct 2025 11:39:59 +0100 Subject: [PATCH 5/6] Update redirect --- config.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config.ts b/config.ts index e816b45a..264900a0 100644 --- a/config.ts +++ b/config.ts @@ -5,32 +5,32 @@ const siteConfig = { }, redirects: [ { - fromPath: '/dataguide/postgresql/setting-up-a-local-postgresql-database', + fromPath: '/postgresql/setting-up-a-local-postgresql-database', toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/setting-up-a-local-postgresql-database', isPermanent: false, }, { - fromPath: '/dataguide/postgresql/introduction-to-data-types', + fromPath: '/postgresql/introduction-to-data-types', toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/introduction-to-data-types', isPermanent: false, }, { - fromPath: '/dataguide/postgresql/date-type', + fromPath: '/postgresql/date-type', toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/date-types', isPermanent: false, }, { - fromPath: '/dataguide/postgresql/connecting-to-postgresql-databases', + fromPath: '/postgresql/connecting-to-postgresql-databases', toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/connecting-to-postgresql-databases', isPermanent: false, }, { - fromPath: '/dataguide/postgresql/short-guides/connection-uris', + fromPath: '/postgresql/short-guides/connection-uris', toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/connection-uris', isPermanent: false, }, { - fromPath: "/dataguide/intro/database-glossary", + fromPath: '/intro/database-glossary', toPath: "https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/database-glossary", isPermanent: false, } From 3070123455250321baabb96e97dd8d170e606ab7 Mon Sep 17 00:00:00 2001 From: Carla Goncalves Date: Wed, 15 Oct 2025 11:47:23 +0100 Subject: [PATCH 6/6] fix redirect typo --- config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.ts b/config.ts index 264900a0..a24bf2dc 100644 --- a/config.ts +++ b/config.ts @@ -15,7 +15,7 @@ const siteConfig = { isPermanent: false, }, { - fromPath: '/postgresql/date-type', + fromPath: '/postgresql/date-types', toPath: 'https://www.prisma.io/docs/orm/more/help-and-troubleshooting/dataguide/date-types', isPermanent: false, },