Skip to content

Commit

Permalink
Merge pull request #2124 from newrelic/clang/external-redirects
Browse files Browse the repository at this point in the history
feat(redirects): support redirecting developer urls to external sites
  • Loading branch information
roadlittledawn authored May 25, 2022
2 parents d24bae7 + b5df19b commit 8040909
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const path = require(`path`);
const { execSync } = require('child_process');
const { createFilePath } = require('gatsby-source-filesystem');
const resolveQuickstartSlug = require('./src/utils/resolveQuickstartSlug.js');
const externalRedirects = require('./src/data/external-redirects.json');

const kebabCase = (string) =>
string
Expand Down Expand Up @@ -83,6 +84,19 @@ exports.createPages = async ({ actions, graphql, reporter }) => {

const { allMdx, allNewRelicSdkComponent, allNewRelicSdkApi } = result.data;

if (externalRedirects.length > 0) {
externalRedirects.forEach(({ url, paths }) => {
paths.forEach((path) => {
createRedirect({
fromPath: path,
toPath: url,
isPermanent: true,
redirectInBrowser: true,
});
});
});
}

createRedirect({
fromPath: `/instant-observability/`,
toPath: `https://newrelic.com/instant-observability`,
Expand Down
1 change: 1 addition & 0 deletions src/data/external-redirects.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]

0 comments on commit 8040909

Please sign in to comment.