diff --git a/gatsby-config.js b/gatsby-config.js index e98817c6..d779698e 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -8,6 +8,7 @@ module.exports = { plugins: [ `gatsby-plugin-react-helmet`, `gatsby-transformer-sharp`, + `gatsby-plugin-meta-redirect`, { resolve: `gatsby-source-filesystem`, options: { diff --git a/gatsby-node.js b/gatsby-node.js index 568b68d6..980f9cbb 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -100,7 +100,7 @@ exports.createSchemaCustomization = ({ actions }) => { } exports.createPages = async ({ graphql, actions, reporter }) => { - const { createPage } = actions + const { createPage, createRedirect } = actions /** * Create pages for members @@ -236,4 +236,20 @@ exports.createPages = async ({ graphql, actions, reporter }) => { } }, }) + + // Create redirect for mobile feedback + + // HACK: This is hardcoded for now, in the future we probably want a more + // scalable way to handle link shortening + const feedbackForms = [ + { slug: 'android', url: 'https://airtable.com/appFRa4NQvNMEbWsA/shrn4VbSQa8QDj8OG' }, + { slug: 'ios', url: 'https://airtable.com/appFRa4NQvNMEbWsA/shrVrNXT4PpI7nqvD' }, + ] + + feedbackForms.forEach(({ slug, url }) => { + createRedirect({ + fromPath: `/feedback/${slug}`, + toPath: url, + }) + }) } diff --git a/package.json b/package.json index e41781f4..1fc5301b 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "gatsby-plugin-feed": "^2.13.0", "gatsby-plugin-google-analytics": "^2.11.0", "gatsby-plugin-manifest": "^2.12.0", + "gatsby-plugin-meta-redirect": "^1.1.1", "gatsby-plugin-offline": "^3.10.0", "gatsby-plugin-react-helmet": "^3.10.0", "gatsby-plugin-remote-images": "^2.1.0", diff --git a/yarn.lock b/yarn.lock index cea8c124..aba97cbc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6031,6 +6031,15 @@ fs-extra@^4.0.2: jsonfile "^4.0.0" universalify "^0.1.0" +fs-extra@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" + integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + fs-extra@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" @@ -6248,6 +6257,13 @@ gatsby-plugin-manifest@^2.12.0: semver "^7.3.2" sharp "^0.27.0" +gatsby-plugin-meta-redirect@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/gatsby-plugin-meta-redirect/-/gatsby-plugin-meta-redirect-1.1.1.tgz#058e8e53edff38dc44d3bb6153109d01c910f863" + integrity sha512-Oc4qgU3SlDUM9qoxIMKO+re2bdMs3/a2KXrfL65gb8XMLsHylBbveWtXZRhgjd2QDL/49RX4S9SEykuadRju2w== + dependencies: + fs-extra "^7.0.0" + gatsby-plugin-offline@^3.10.0: version "3.10.0" resolved "https://registry.yarnpkg.com/gatsby-plugin-offline/-/gatsby-plugin-offline-3.10.0.tgz#b860ff5d630122b1603d7477f7962161622e0bc4"