Gatsby Query on build vs dynamic content

Hello Prismic community. We are quite new to Prismic and would like to know if the can have the following implementation. Privacy preserving is very import to use thus we can’t make any request to the Prismic domain after the deployment of our static sites.

I have looked at the demo and also created a test application on my side. Both instances there is outgoing request to prismic. We want to pull all necessary content(including locales) when application is building. After that there shouldn’t be any outgoing request to Prismic domain.

Is is possible to do this and how can we do this.

Thank you in advance.

Hello Jeremy, and welcome to the community forum!

Could you give me more details of what you need?
Which outgoing requests are you referring to?

When you build a Gatsby project, every page in your site will be delivered upfront, so your project relies on a source JSON file that has everything your pages need (including all the documents from all the locales you have available on your repo, if you’ve enabled a multilang config in your gatsby project) so that you only do one fetch in GraphQL, then it generates a static website.

Hi @paulina.gavilan, Thank you for answering my question. Well if you look at this example - https://prismic-gatsby-multi-language-demo.netlify.app/ . There is outgoing request to the prismic domain.

We can only allow outgoing request to the prismic domain on the build stage.

Hi Jeremy,

I think the outgoing request your talking about is coming from the toolbar script which is used for our previews, it looks like this.

<script type="text/javascript" src="//static.cdn.prismic.io/prismic.min.js"></script>

What it does is check for logged in Prismic users and their cookies being sent from their Prismic endpoint and build your document previews on top of your application.

I believe you can turn this of in the api options of your gatsby config with the follow setting,

previews: false,

Hi @Phil, thank you taking time answering my question. I already tried changing previews to false. There is still outgoing request to the Prismic domain even if previews is set to false.

In that case I’m not sure the script can be properly removed from the plugin, I’ll check with the team if this is the case. If you want to be able to use documents previews this script is essential.

@Phil Thank you, I understand. We won’t be using the preview functionality on production deployed websites.

Please let me know if there is any feedback from the team.

Thanks You

OK, so for that plugin you can’t switch off the preview script.

This issue has been closed due to inactivity.