Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(gatsbynode): add onlyLanguages option #234

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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]
    },
  },
});

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant