Gatsby plugin i18n
This plugin is meant to be used with netlify and its gatsby-plugin-netlify to correctly handle redirects server side. A less SEO friendly alternative would be to use this plugin alongside gatsby-plugin-meta-redirect or gatsby-plugin-client-side-redirect, they all exploit the gatsby's
- Components specific string are prefixed by the component name in PascalCase, e.g. for component
Headerthe string prefix is
- Pages and templates specific strings are prefixed by the page component name all lowercase minus the prefix
Template, e.g. for page about the component would be
PagesAboutand the string prefix is
about., for the template blog-single the component would be
TemplateBlogSingleand the string prefix is
- Generic strings not tight to any component or page in particular are prefxed with a
.dot and begin lowercase, e.g.
- Gatsby generates a warning like:
warn There are routes that match both page and redirect. It will result in page not being accessible; this is probably not intentional: - page: "/" and redirect: "/" -> "/it/"
That is fine as the redirect is created with the
Language Netlify's specific option for
createRedirect and therefore the warning message is misleading as it does not take into account the language based redirect.
- Gatsby's warnings:
warn Plugin `@kuus/gatsby-plugin-i18n` has customized the built-in Gatsby GraphQL type `File`. This is allowed, but could potentially cause conflicts. warn Plugin `gatsby-plugin-mdx` has customized the GraphQL type `Mdx`, which has already been defined by the plugin `@kuus/gatsby-plugin-i18n`. This could potentially cause conflicts.
are fine... We need to customise those Node's types to have a seamless localization API.
- Netlify redirects adn localization
- Gatsby netlify plugin
- Examples of internationalised Gatsby sites:
- overreacted.io We might get from there the mechanism that scan the markdown files and auto-localise links.
- About 404:
There are many on
Language based redirects
Netlify when loading a page directly or refreshing the browser when you are on a page without a trailing slash it will redirect to the same url with a trailing slash, this happens even with
Pretty URLS setting disabled on Netlify panel. See this issue. Until this issue with netlify is not solved we set by default trailing slashed on all paths with the util
- Add support for server side redirects in frontmatter, see Programmatic Redirects in Gatsby