Source plugin for pulling documents into Gatsby from prismic.io repositories.
npm install --save gatsby-source-prismic
// In your gatsby-config.js
plugins: [
{
resolve: `gatsby-source-prismic`,
options: {
repositoryName: `your_repository_name`,
accessToken: `your_acces_token`,
// Link resolver used whenever an HTML field is created.
linkResolver: ({ node, key, value }) => doc => {
// your link resolver
},
// HTML serializer used whenever an HTML field is created.
htmlSerializer: ({ node, key, value }) => (element, content) => {
// your HTML serializer
}
},
},
]
You can query Document nodes created from prismic.io like the following:
{
allPrismicDocument {
edges {
node {
id
data {
# Your fields here
}
}
}
}
}
If the field is of type RichText or Title, HTML, text, and raw values are available:
{
allPrismicDocument {
edges {
node {
id
data {
title {
text
}
content {
html
}
footnote {
raw {
type
text
spans {
type
start
end
}
}
}
credit {
rawString
}
}
}
}
}
}