# Trouble implementing previews with multi-locale site

**URL:** <https://community.prismic.io/t/trouble-implementing-previews-with-multi-locale-site/1384>\
**Category:** Developing with Prismic\
**Tags:** gatsby\
**Created:** [July 30, 2020, 8:02am UTC](https://community.prismic.io/t/trouble-implementing-previews-with-multi-locale-site/1384 "2020-07-30T08:02:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sean](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/sean/32/464_2.png) [@sean](https://community.prismic.io/u/sean)\
**Post date:** [July 30, 2020, 8:02am UTC](https://community.prismic.io/t/trouble-implementing-previews-with-multi-locale-site/1384/1 "2020-07-30T08:02:32Z")

</div>

Hi there,

I'm having quite a bit of trouble trying to set up Prismic previews and I'm hoping to get some help.

Here is a sample of what my gatsby-config and link-resolver look like:

![image.png](https://mail.google.com/mail/u/0?ui=2&ik=48d19b4a62&attid=0.2&permmsgid=msg-f:1673560117081572973&th=1739ae0f40e8866d&view=fimg&sz=s0-l75-ft&attbid=ANGjdJ_CPg8JuPJbicwB-OauMYJvHMuCYEU9tpHtymIcz9hTRPVIZ4N64Hh-KJRI88Gxn1OlbAE9IOLyzyEWPZAuMsR1FBiiLGkg8ytYGS4cEYi9QQ8ugd6C4r52DCw&disp=emb&realattid=ii_kd67vlud15)

_(/preview/ is set in the Prismic preview settings, including the trailing slash. I heard there are issues with no trailing slash + AWS + Prismic preview so I added it here, though I haven't gotten so far as to test that yet. Also not sure if I should be using `path` or `previewPath` here. The Prismic docs say `path` but looking at the source of the plugin, I think this has been changed to `previewPath`?)_

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/1X/9a69ad4a6a9fc197305abd00d4f009b82717f660.png)

Here are some of the issues I am facing:

1. I'm pretty sure I've gone through all the steps to set up previews (I followed [this](https://prismic.io/docs/gatsby/misc-topics/previews) as well as a lot of looking around), but when I make a change in e.g. the homepage in Prismic, save it and then click on the preview button (set up for localhost), I get the Gatsby dev 404 page (see screenshot). If I then navigate to /homepage/preview (the `previewPath` I set up in gatsby-config) then the preview appears to work for that page. Interestingly, it also seems to work if I navigate to /en, which is our homepage URL. How do you normally handle this? I assume the preview button is supposed to redirect me to the correct page (not sure if that should be /homepage/preview or /en in this case).

![image.png](https://mail.google.com/mail/u/0?ui=2&ik=48d19b4a62&attid=0.1&permmsgid=msg-f:1673560117081572973&th=1739ae0f40e8866d&view=fimg&sz=s0-l75-ft&attbid=ANGjdJ_ManGe-BpNEuNCoMUcYJE0ghUjyA1OwJsselHlRQhP1oJ4b178cmH53SYjCzrg01HvfeHvesyYhQkhxgYof0F75b5EY14zZCoqFZZR9Nn2KvpAe2cPWt5TJ64&disp=emb&realattid=ii_kd67mq5w14)

1. If I make a change to a document in a locale other than the default locale, e.g. Danish, and I click the preview button, I still get the 404 page, but even if I then navigate to the preview path (/homepage/preview) I see the English page and none of the edits. If I go to /da (Danish homepage) I can see the correct locale as well as the live preview edits. This last case seems fine, but then I'm not sure what the point of setting the preview paths is(?), and I guess it should automatically direct us there when clicking the preview button from Prismic.

2. A lot of my content in Prismic is split out into components. I guess there wouldn't be a certain preview path that would make sense to show when editing content in this, as they could be used in various pages. Do you have any suggestions on how to handle this?

3. I am using the `useStaticQuery` hook for content queries in components. I see it says in the plugin README that this isn't supported, but it has seemed to work for me. Is it just for previews that it doesn't work (seems to be the case)? I see an example of using `withPreview` with the `StaticQuery` component - do you know if it's possible to get it working with hooks, or do I have to refactor to use the `StaticQuery` component (this would be a bummer)?

As I mentioned, my content models are very componentised, so the content for any given page may be shared between different components. Is it possible to view live preview changes across different components and/or across different locales in one preview session? It seems like a preview session only shows changes for the document that initiated the preview?

Any help would be much appreciated.

---

<div class="post-metadata">

**Author:** ![marc.mcintosh](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/marc.mcintosh/32/25_2.png) [@marc.mcintosh](https://community.prismic.io/u/marc.mcintosh)\
**Post date:** [July 31, 2020, 10:13am UTC](https://community.prismic.io/t/trouble-implementing-previews-with-multi-locale-site/1384/2 "2020-07-31T10:13:17Z")

</div>

Hello,  
Which are you using the `@prismicio/gatsby-source-prismic-graphql` plugin? the useStaticQuery should be working.

the path set in previewPath is for redirecting. (plus some other stuff)

> but then I’m not sure what the point of setting the preview paths is(?)

the plug builds a page there, this is also where you will be redirected when clicking the preview button in primic.

For the multi langage issue can you recreate the issue in the examples folder here?

> **[GitHub - prismicio/gatsby-source-prismic-graphql: Gatsby source plugin for...](https://github.com/prismicio/gatsby-source-prismic-graphql)**
>
> Gatsby source plugin for Prismic GraphQL . Contribute to prismicio/gatsby-source-prismic-graphql development by creating an account on GitHub.

Thanks

Marc

---

<div class="post-metadata">

**Author:** ![sean](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/sean/32/464_2.png) [@sean](https://community.prismic.io/u/sean)\
**Post date:** [August 3, 2020, 11:18am UTC](https://community.prismic.io/t/trouble-implementing-previews-with-multi-locale-site/1384/3 "2020-08-03T11:18:36Z")

</div>

Hi @marc.mcintosh ,

Thanks for the response.

I was using [gatsby-source-prismic-graphql](https://github.com/birkir/gatsby-source-prismic-graphql/) but have just switched [the Prismic fork](https://github.com/prismicio/gatsby-source-prismic-graphql).

I still can't get components using `useStaticQuery` to work with the preview. i.e. I have a header component and a header content model, and when I try changing some content in the document in Prismic and then save and try to preview, I don't see any changes.

I'm still not sure I follow the difference between the `options.pages.path` option and `options.pages.previewPath`. It looks like `path` was changed to `previewPath` [in this PR](https://github.com/birkir/gatsby-source-prismic-graphql/commit/e4baba7bc2c5295bdbb9d20f083891dd127165b1#diff-1d28aeee235360afce83f233bce24624L4-R4) but but Prismic docs seem to say to use `path`:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/1X/63508c2cbf89b68c52b195c2f1f249d687f049be.png)

> [@marc.mcintosh](#):
>
> For the multi langage issue can you recreate the issue in the examples folder here?

Did you want me to create a reproducible test case, or did you mean to try copying the configuration of one of the examples there? (I checked, but it didn't look like any of the examples there were implementing preview functionality - let me know if I missed something)

---

<div class="post-metadata">

**Author:** ![marc.mcintosh](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/marc.mcintosh/32/25_2.png) [@marc.mcintosh](https://community.prismic.io/u/marc.mcintosh)\
**Post date:** [August 31, 2020, 9:58am UTC](https://community.prismic.io/t/trouble-implementing-previews-with-multi-locale-site/1384/4 "2020-08-31T09:58:29Z")

</div>

Hi Sean,

Use previewPath,

We’ll have to update the documentation 🙂

---

<div class="post-metadata">

**Author:** ![Fares](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@Fares](https://community.prismic.io/u/Fares)\
**Post date:** [September 24, 2020, 12:42pm UTC](https://community.prismic.io/t/trouble-implementing-previews-with-multi-locale-site/1384/5 "2020-09-24T12:42:41Z")

</div>

closed on September 24, 2020, 12:42pm UTC, flag & select 'Something Else' to reopen.

This issue has been closed due to inactivity.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [December 9, 2021, 5:21pm UTC](https://community.prismic.io/t/trouble-implementing-previews-with-multi-locale-site/1384/6 "2021-12-09T17:21:53Z")

</div>

Opened on December 9, 2021, 5:21pm UTC


