Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preview configuration / graphql query with $slug #31

Open
Aleksi44 opened this issue Nov 10, 2020 · 1 comment
Open

Preview configuration / graphql query with $slug #31

Aleksi44 opened this issue Nov 10, 2020 · 1 comment

Comments

@Aleksi44
Copy link

Hey, nice job this plugin for gatsby :)

I get an empty body [] on my TestTemplate when I use Wagtail Preview.
The slug that I receive in my graphql query seem to be not correct.

export const query = graphql`
  query Test($slug: String) {
    wagtail {
      page(slug: $slug) {
        seoTitle
        seoDescription
        lastPublishedAt
        ... on TestPage {
          body {
            ... on MyTextBlock {
              blockType
              text
            }
            ... on MyImageBlock {
              blockType
              image {
                url
                title
              }
            }
          }
        }
      }
    }
  }

When I write the slug of my page directly in the code, it works.

export const query = graphql`
  query {
    wagtail {
      page(slug: "perfect") {
        seoTitle
        seoDescription
        lastPublishedAt
        ... on TestPage {
          body {
            ... on MyTextBlock {
              blockType
              text
            }
            ... on MyImageBlock {
              blockType
              image {
                url
                title
              }
            }
          }
        }
      }
    }
  }

I don't know if it's my wagtail preview configuration or a bug.
I created a repo here.

Do you know what I'm doing wrong?

@Aleksi44
Copy link
Author

I finally used a custom preview with gatsby-plugin-graphql-preview and a redirect on my wagtail page.

This custom preview suppress these issues :

I created a repo here.

I leave this issue open if it can help anyone.
Feel free to close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant