New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-plugin-prismic-preview

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-plugin-prismic-preview

Enable previews for gatsby-source-prismic

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
Maintainers
1
Weekly downloads
 
Created
Source

Prismic preview

Enable previews of your prismic documents

Installing

Install module

npm install --save gatsby-plugin-prismic-preview

Add plugin to gatsby-config.js:

{
  resolve: 'gatsby-plugin-prismic-preview',
  options: {
    repositoryName: 'gatsby-source-prismic-test-site',
    linkResolver: require('./src/linkResolver'),
    path: '/preview',
  }
}

Configuration

repositoryName

Should be the same as the one in gatsby-source-prismic plugin

linkResolver

Inline function

options: {
  linkResolver(doc) {
    if (doc.type === 'BlogPost') {
      return `/blog/${doc.uid}`;
    }
    return `${doc.type}`;
  },
},

or a require to a specific file (must be ES5 module.exports format)

options: {
  linkResolver: require('./src/utils/linkResolver'),
},

path

Where the preview page should live.

Defaults to /preview.

Staging environment

Only allow previews on staging? In gatsby-config.js do a conditional operation:

const plugins = [
  'plugin-1',
  'plugin-2',
];

if (process.env.NODE_ENV === 'staging') {
  plugins.push({
    resolve: 'gatsby-plugin-prismic-preview',
    options: {}
  });
}

module.exports = {
  siteMetadata: {
    title: 'Gatsby Default Starter',
  },
  plugins,
};

Troubleshooting

Keywords

FAQs

Package last updated on 23 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc