Skip to content

Commit

Permalink
chore: Update generated redirects to permanent. COVID19Tracking#1671
Browse files Browse the repository at this point in the history
  • Loading branch information
kevee committed Jan 4, 2021
1 parent 70114c1 commit eb82954
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,15 @@ exports.createPages = async ({ graphql, actions }) => {
createRedirect({
fromPath: `/document/download/${node.slug}`,
toPath: node.document.file.url,
isPermanent: true,
})
})

result.data.allContentfulRedirect.nodes.forEach(({ from, redirectTo }) => {
createRedirect({
fromPath: from,
toPath: redirectTo,
isPermanent: true,
})
})

Expand Down Expand Up @@ -194,6 +196,7 @@ exports.createPages = async ({ graphql, actions }) => {
createRedirect({
fromPath: `/data/state/${slug}/screenshots`,
toPath: `https://screenshots.covidtracking.com/${slug}`,
isPermanent: true,
})
})

Expand Down Expand Up @@ -230,6 +233,7 @@ exports.createPages = async ({ graphql, actions }) => {
createRedirect({
fromPath: shortPath,
toPath: node.overrideBlogPath,
isPermanent: true,
})
} else {
createPage({
Expand All @@ -241,6 +245,7 @@ exports.createPages = async ({ graphql, actions }) => {
createRedirect({
fromPath: shortPath,
toPath: longPath,
isPermanent: true,
})
}
})
Expand Down

0 comments on commit eb82954

Please sign in to comment.