Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@3nvi/gatsby-plugin-intl

3nvi60MIT0.4.20

A plugin to automatically generate localized versions of your pages with SEO support

gatsby, gatsby-plugin, gatsby-plugin-intl, i18n, intl, internalization, multi-language

readme

gatsby-plugin-intl

Helps with i18n by creating pages for all your supported locales. This is a low level plugin that gatsby-theme-intl depends upon. You should be using it only if you already have a methodology for handling translations.

Features

In short, this plugin:

  • Creates a page for each of your locales and exposes them through different URLs
  • Creates all the necessary SEO tags for each of your new localized pages
  • Creates proper redirects based on Language headers, as well as the default/fallback language

This plugin scans all your pages (those under /pages and the ones created dynamically through the createPage API) and creates localized versions for each one, depending on your supported locales. While there, it also automatically creates the proper SEO tags (depending on the page), so you don't have to worry about implementing the SEO manually

What it doesn't do

This plugin doesn't handle translations, but delegates that to the developer. If you want an easy way to handle translations while using this plugin, please visit gatsby-theme-intl for an all-in-one solution.

Examples

Let's say you have a single page under pages/about.js and your supported locales are en and fr (with en being the default one). This plugin will create the following:

  • A french variation of about with proper SEO tags accessible under /fr/about
  • An english variation of about with proper SEO tags accessible under /en/about
  • Proper redirect definitions based on your accept-language header
  • Default redirect definitions from /about to /en/about/ when accept-language is not present

As stated, translation is delegated to the user. Use gatsby-theme-intl for if you want a package that includes translations.

Quick Start

This plugin depends on react-helmet as a peer dependency

npm i react-helmet gatsby-plugin-react-helmet @3nvi/gatsby-plugin-intl

and in your gatsby-config.js:

{
    // ... rest of your config
    plugins: [
        // ... other plugins
        `gatsby-plugin-react-helmet`,
        `@3nvi/gatsby-plugin-intl`
    ]
}

Configuration

The plugin accepts the following optional options:

  • supportedLanguages: An array of locales that your application supports. Defaults to ['en'].
  • defaultLanguage: The default/fallback locale of your application. Defaults to en.
  • siteUrl: The URL of your site that's used when creating SEO tags. Defaults to the environment variable URL (which platforms like Netlify automatically populate) or to localhost:8000 if the environment variable is not present.
  • excludedPages: A list page paths that the plugin should ignore. Defaults to [].
  • notFoundPage: The URL for a custom 404 page. Defaults to /404/.
  • deleteOriginalPages: A boolean denoting whether to delete the original non-localized pages or retain them at their original paths. Defaults to true.

Client-Only Routes

Please refer to the related section in gatsby-theme-intl

Changelog

Please refer to the Changelog for information on the details of each release

License

MIT

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

0.4.20 (2021-05-27)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.4.19 (2021-05-27)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.4.18 (2021-05-27)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.4.17 (2021-05-27)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.4.16 (2021-05-27)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.4.15 (2021-05-27)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.4.14 (2021-05-27)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.4.13 (2020-07-05)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.4.12 (2020-06-27)

Bug Fixes

  • change canonical URL when deleteOriginalPages is false (4143f7a)

0.4.11 (2020-06-27)

Bug Fixes

  • don't add original page redirect when original pages exist (7079450)

0.4.10 (2020-05-31)

Bug Fixes

  • change default value of deleteOriginalPages for dev (565fc5c)

0.4.8 (2020-05-30)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.4.7 (2020-05-30)

Bug Fixes

  • gatsby-plugin-intl: issue with client-only route redirercts (e5201a8)

0.4.3 (2020-03-29)

Bug Fixes

0.4.1 (2020-03-29)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.4.0 (2020-03-29)

Features

  • deleteOriginalPages option (2f81730)

0.3.0 (2020-03-28)

Features

  • remove deleteOriginalPages option (eee1eb8)

0.2.2 (2020-03-28)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.2.1 (2020-03-28)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.2.0 (2020-03-28)

Features

0.1.24 (2020-03-28)

Features

  • add deleteOriginalPages option (7713f1b)

0.1.23 (2020-03-28)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.1.22 (2020-03-28)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.1.21 (2020-03-28)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.1.20 (2020-03-28)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.1.19 (2020-03-28)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.1.17 (2020-03-28)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.1.16 (2020-03-28)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.1.15 (2020-03-27)

Bug Fixes

0.1.14 (2020-03-27)

Bug Fixes

0.1.13 (2020-03-27)

Bug Fixes

  • point package main to top level index (6cea6e0)
  • gatsby-theme-plugin: remove lock (9cf4630)

0.1.12 (2020-03-22)

Bug Fixes

  • gatsby-plugin-intl: add fallback for optional plugin option (282b4f2)

0.1.11 (2020-03-22)

Bug Fixes

  • gatsby-plugin-intl: add default localhost port to 8080 (8e5d6ab)
  • gatsby-plugin-intl: don't add SEO-intl Helmet for excluded pages (84165c4)

0.1.10 (2020-03-19)

Features

  • gatsby-plugin-intl: add notFoundPage and excludedPages option (5f9f49f)
  • gatsby-plugin-intl: add 404 support (ed70068)

0.1.9 (2020-03-19)

Features

  • gatsby-plugin-intl: add notFoundPage and excludedPages option (5f9f49f)
  • gatsby-plugin-intl: add 404 support (ed70068)

0.1.8 (2020-03-19)

Features

  • gatsby-plugin-intl: add notFoundPage and excludedPages option (5f9f49f)
  • gatsby-plugin-intl: add 404 support (ed70068)

0.1.7 (2020-03-19)

Features

  • gatsby-plugin-intl: add notFoundPage and excludedPages option (5f9f49f)
  • gatsby-plugin-intl: add 404 support (ed70068)

0.1.6 (2020-03-05)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.1.5 (2020-03-05)

Bug Fixes

  • package.json: add public access (50d9259)

0.1.4 (2020-03-05)

Bug Fixes

0.1.3 (2020-03-05)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.1.2 (2020-03-05)

Note: Version bump only for package @3nvi/gatsby-plugin-intl

0.1.1 (2020-03-05)

Note: Version bump only for package @3nvi/gatsby-plugin-intl