{"id":15437,"library":"gatsby-plugin-meta-redirect","title":"Gatsby Meta Refresh Redirect Plugin","description":"gatsby-plugin-meta-redirect is a Gatsby plugin designed to generate static HTML files containing a `<meta http-equiv=\"refresh\">` tag. This enables client-side redirects on any static file host, such as S3 or Netlify, without requiring server-side redirect rules or `.htaccess` configurations. The plugin processes `createRedirect` actions called within Gatsby's Node API (e.g., in `gatsby-node.js`) and outputs an `index.html` file at the `fromPath` containing the meta refresh tag pointing to the `toPath`. Currently at version 1.1.1, the package has not seen updates in over seven years, indicating an abandoned maintenance schedule. Its primary differentiator is the universal compatibility across static hosts, but this comes with SEO and user experience trade-offs compared to server-side 301 redirects.","status":"abandoned","version":"1.1.1","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/getchalk/gatsby-plugin-meta-redirect","tags":["javascript","gatsby","gatsby-plugin"],"install":[{"cmd":"npm install gatsby-plugin-meta-redirect","lang":"bash","label":"npm"},{"cmd":"yarn add gatsby-plugin-meta-redirect","lang":"bash","label":"yarn"},{"cmd":"pnpm add gatsby-plugin-meta-redirect","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This is a plugin for the Gatsby framework and relies on its build process and Node APIs.","package":"gatsby","optional":false}],"imports":[{"note":"This plugin does not export any JavaScript symbols for direct import. Its functionality is enabled by adding it to the `plugins` array in `gatsby-config.js`. The configuration must be the last entry in the plugins array for proper operation.","wrong":"import gatsbyPluginMetaRedirect from 'gatsby-plugin-meta-redirect';","symbol":"gatsby-plugin-meta-redirect","correct":"// in gatsby-config.js\nplugins: [\n  // other plugins...\n  `gatsby-plugin-meta-redirect` // must be last\n];"},{"note":"`createRedirect` is a Gatsby Node API action (provided via `actions` object), not an export of `gatsby-plugin-meta-redirect`. The plugin *consumes* these actions to generate the HTML redirect files.","wrong":"import { createRedirect } from 'gatsby-plugin-meta-redirect';","symbol":"createRedirect","correct":"// in gatsby-node.js\nexports.createPages = async ({ actions }) => {\n  const { createRedirect } = actions;\n  createRedirect({\n    fromPath: '/old-url/',\n    toPath: '/new-url/',\n    isPermanent: true,\n    redirectInBrowser: true\n  });\n  // ... other createPage calls\n};"}],"quickstart":{"code":"// gatsby-config.js\nmodule.exports = {\n  plugins: [\n    // Ensure this plugin is the last one in your array\n    `gatsby-plugin-meta-redirect`\n  ]\n};\n\n// gatsby-node.js\nconst path = require('path');\n\nexports.createPages = async ({ actions, graphql }) => {\n  const { createRedirect, createPage } = actions;\n\n  // Example 1: Basic permanent redirect\n  createRedirect({\n    fromPath: '/legacy-page/',\n    toPath: '/new-destination/',\n    isPermanent: true,\n    redirectInBrowser: true\n  });\n\n  // Example 2: Redirect with a language preference\n  createRedirect({\n    fromPath: '/global-content/',\n    toPath: '/en-US/global-content/',\n    Language: 'en'\n  });\n\n  // Example 3: Programmatic redirect based on data (e.g., old blog post slugs)\n  const result = await graphql(`\n    {\n      allMarkdownRemark {\n        edges {\n          node {\n            frontmatter {\n              slug\n              oldPaths\n            }\n          }\n        }\n      }\n    }\n  `);\n\n  if (result.errors) {\n    throw result.errors;\n  }\n\n  const posts = result.data.allMarkdownRemark.edges;\n\n  posts.forEach(({ node }) => {\n    if (node.frontmatter.oldPaths) {\n      node.frontmatter.oldPaths.forEach(oldPath => {\n        createRedirect({\n          fromPath: oldPath,\n          toPath: node.frontmatter.slug,\n          isPermanent: true,\n          redirectInBrowser: true\n        });\n      });\n    }\n    createPage({\n      path: node.frontmatter.slug,\n      component: path.resolve('./src/templates/blog-post.js'),\n      context: {\n        slug: node.frontmatter.slug,\n      },\n    });\n  });\n};","lang":"javascript","description":"This quickstart demonstrates how to configure `gatsby-plugin-meta-redirect` in `gatsby-config.js` and how to define redirects using Gatsby's `createRedirect` action within `gatsby-node.js` for both static and data-driven redirect scenarios. It illustrates basic permanent redirects, language-specific redirects, and iterating over markdown frontmatter to generate redirects programmatically."},"warnings":[{"fix":"Ensure `gatsby-plugin-meta-redirect` is the final plugin listed in `gatsby-config.js`.","message":"The `gatsby-plugin-meta-redirect` plugin *must* be the last entry in the `plugins` array within your `gatsby-config.js` file. Failure to do so can result in redirects not being generated or working incorrectly, as other plugins might interfere with the build output or path generation.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"For SEO-critical permanent redirects, prefer hosting-provider-specific 301 redirect solutions (e.g., Netlify `_redirects` file, Vercel redirects in `vercel.json`, or server-side configurations) if your host supports them. Use this plugin when server-side control is not available or for non-SEO-critical temporary redirects.","message":"This plugin generates redirects using client-side `<meta http-equiv=\"refresh\">` tags, not server-side 301 HTTP redirects. While functional for static hosting, meta refresh redirects are generally less favorable for Search Engine Optimization (SEO) as they are treated as temporary (302-like) redirects by search engines and may not pass full link equity. They can also lead to a poorer user experience due to a slight delay.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Evaluate alternatives like `gatsby-plugin-client-side-redirect` (though also old) or server-side redirect solutions provided by your hosting provider. For new projects, consider Gatsby versions that have native redirect capabilities or more actively maintained plugins.","message":"The `gatsby-plugin-meta-redirect` package has not been updated in over seven years (last published in November 2018) and is considered unmaintained. This raises concerns about compatibility with newer Gatsby versions, Node.js environments, and potential security vulnerabilities that will not be addressed.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Move `gatsby-plugin-meta-redirect` to the very end of the `plugins` array in your `gatsby-config.js` file.","cause":"The `gatsby-plugin-meta-redirect` plugin is not placed last in the `plugins` array in `gatsby-config.js`, allowing other plugins to override or interfere with its output.","error":"Redirect not working or generating correctly."},{"fix":"For critical redirects, implement true 301 server-side redirects via your hosting provider's configuration (e.g., `_redirects` file for Netlify/Vercel, NGINX rules for custom servers) instead of relying solely on meta refresh. Update internal links and sitemaps to point to the final URLs.","cause":"The plugin uses `<meta http-equiv=\"refresh\">` which is interpreted by search engines as a soft redirect (similar to a 302 'Found' status), not a permanent 301 'Moved Permanently'. This can impact page authority transfer and SEO.","error":"Low SEO ranking for pages with redirects, or 'soft 404' warnings in search console."}],"ecosystem":"npm"}