mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2024-12-27 07:18:17 +01:00
33 lines
657 B
TypeScript
33 lines
657 B
TypeScript
import { CreatePagesArgs } from "gatsby";
|
|
|
|
import * as types from "../types";
|
|
|
|
export interface PagesQueryResult {
|
|
allMarkdownRemark: {
|
|
edges?: Array<types.Edge>;
|
|
};
|
|
}
|
|
|
|
const pagesQuery = async (graphql: CreatePagesArgs["graphql"]) => {
|
|
const result = await graphql<PagesQueryResult>(`
|
|
{
|
|
allMarkdownRemark(filter: { frontmatter: { draft: { ne: true } } }) {
|
|
edges {
|
|
node {
|
|
frontmatter {
|
|
template
|
|
}
|
|
fields {
|
|
slug
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`);
|
|
|
|
return result?.data?.allMarkdownRemark?.edges ?? [];
|
|
};
|
|
|
|
export default pagesQuery;
|