In Gatsby I'm trying to use dynamic query in my wrapPageElement, but apparently it doesn't run at all. I use the same syntax as in normal page queries:
export const query = graphql `
query PageLayout($locale: String) {
pages: allMarkdownRemark(sort: {fields: [frontmatter___title], order: DESC}, filter: {frontmatter: {draft: {nin: true}}, fields: {locale: {eq: $locale}, collection: {in: ["pages"]}}}) {
nodes {
frontmatter {
title
}
fields {
slug
}
}
}
}`;
Any proposal how to implement? The idea is that, there is a Nav element, which is part of the main Layout, so it should be able to list my pages.
Thanks for all