Skip to content

Gatsby source plugin that fetches the list of locales from a given Contentful space

License

Notifications You must be signed in to change notification settings

joseguerrerov/gatsby-source-contentful-locales

Folders and files

NameName
Last commit message
Last commit date

Latest commit

49946a2 Β· Jun 28, 2020

History

12 Commits
Jun 28, 2020
Jun 17, 2020
Jun 28, 2020
Jun 17, 2020
Jun 28, 2020
Jun 17, 2020
Jun 28, 2020
Jun 17, 2020
Jun 28, 2020
Jun 28, 2020
Jun 28, 2020

Repository files navigation

gatsby-source-contentful-locales

Source plugin for pulling locales from contentful spaces. It creates a list with all the locales available and exposes information like default locale and fallback locale.

Install

# npm
npm install --save gatsby-source-contentful-locales
# yarn
yarn add gatsby-source-contentful-locales

Usage

// In your gatsby-config.js
// Learn about environment variables on Gatsby: https://gatsby.dev/env-vars
module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-contentful-locales`,
      options: {
        spaceId: process.env.CONTENTFUL_SPACE_ID,
        accessToken: process.env.CONTENTFUL_ACCESS_TOKEN,
      },
    },
  ],
}

Configuration options

spaceId [string][required]

Contentful spaceId

accessToken [string][required]

Contentful delivery api key

How to query

{
  allContentfulLocale {
    totalCount
      edges {
        node {
          id
          code
          name
          default
          fallbackCode
        }
      }
    }
  }