Hi Priyanka, that seems to do the trick, initially, I noticed that the project document was not previewing then I checked the link-resolver and realised that it should be named case_study.
A question in regards to the preview, do you have to click the close on the toolbar to remove the cookie/stop it previewing when you load the page again?
If anyone has a similar problem, this was my setup below to get the preview for a static site working on Netlify.
nuxt.config.js
ssr: "true",
loading: false,
target: "static",
generate: {
fallback: "404.html",
},
prismic: {
endpoint: "https://your-repo-name.prismic.io/api/v2",
linkResolver: "@/plugins/link-resolver",
},
Link-resolver.js (these must match your nuxt config document type API id's)
My setup:
export default function (doc) {
if (doc.isBroken) {
return "/error";
}
if (doc.type === "home_page") {
return "/";
}
if (doc.type === "work_page") {
return "/work/";
}
if (doc.type === "contact_page") {
return "/contact/";
}
if (doc.type === "insights_page") {
return "/insights/";
}
if (doc.type === "about_page") {
return "/about/";
}
if (doc.type === "studio_page") {
return "/studio/";
}
if (doc.type === "menu") {
return "/";
}
if (doc.type === "social") {
return "/";
}
if (doc.type === "category") {
return "/";
}
if (doc.type === "page") {
return "/page/" + doc.uid;
}
if (doc.type === "case_study") {
return "/project/" + doc.uid;
}
if (doc.type === "article") {
return "/insight/" + doc.uid;
}
if (doc.type === "preview") {
return "/preview" + doc.uid;
}
return "/";
}
Make sure you have the @nuxtjs/prismic dependency added to your project (this way you do not have to include the prismic toolbar js file)