diff --git a/config.ts b/config.ts index d5814d9..a24bf2d 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-types', + 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-node.ts b/gatsby-node.ts index c94c512..fda0e00 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 {