Skip to content

Conversation

thompsonsj
Copy link

#33 is a great idea to permit localized URLs.

This is a simpler version that does not require slugs to be defined in react-intl message files (e.g. en.json ...etc).

This change adds the possibility to limit page generation to certain languages only.

For example, if creating pages dynamically (e.g. from a CMS or the MDX plugin like in ), you can pass a parameter through the page context to ensure only one version of the page is created.

It makes sense to me to nest this option inside a gatsbyPluginIntl to allow for further options to be passed in this manner.

const language = `fr`;
createPage({
  path,
  component: template,
  context: {
    id: node.id,
    language,
    gatsbyPluginIntl: {
      onlyLanguages: [language]
    },
  },
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant