@kogk/gatsby-theme-prismic

This is basically a "sensible defaults" for prismic.

Usage no npm install needed!

<script type="module">
  import kogkGatsbyThemePrismic from 'https://cdn.skypack.dev/@kogk/gatsby-theme-prismic';
</script>

README

@kogk/gatsby-theme-prismic

This is basically a "sensible defaults" for prismic.

It includes:

  • a thing to map slices to components
  • more out-of-the-box previewing experience
  • opinionated about how you define a page

example usage

in gatsby-config.js

module.exports = {
  plugins: [
    {
      resolve: '@kogk/gatsby-theme-prismic',
      options: {
        repositoryName: 'name-of-prismic-repo',
        accessToken: 'access token',
        schemaDir: path.resolve(`./src/data/prismic-schemas/`),
        linkResolver: () => linkResolver,
        previewTypes: ['PrismicPage'],
        pageSources: [
          {
            queryName: 'allPrismicPage',
            template: path.resolve('./src/components/templates/Page/Page.js'),
            pageContext (node) {
              // optionally supply additional page context variables, if needed
              return {
                myContextVar: 'lala'
              }
            }
          }
        ]
      }
    }
  ]
}