Installation

Easily connect your Nuxt.js application to your content hosted on Prismic

Add @nuxtjs/prismic dependency to your project:

yarn add --dev @nuxtjs/prismic
npm install --save-dev @nuxtjs/prismic

Then, add @nuxtjs/prismic to the buildModules section of nuxt.config.js and configure your Prismic API endpoint:

nuxt.config.js
{
  buildModules: [
    '@nuxtjs/prismic'
  ],
  prismic: {
    endpoint: 'https://<REPOSITORY>.cdn.prismic.io/api/v2',
    modern: true
    /* see configuration for more */
  }
}

The modern option allows the module to use future-proof features. If you're new to the module you should leave it on and not worry about it.

More on the modern option in the configuration section.

Finally, you're expected to provide a link resolver function at ~/app/prismic/link-resolver.js:

link-resolver.js
export default function(doc) {
  return '/'
}

More on link resolving on Prismic documentation.

Edit this page on GitHub Updated at Mon, Mar 13, 2023