Preview configuration / graphql query with $slug
Aleksi44 opened this issue · comments
Alexis Le Baron commented
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?
Alexis Le Baron commented