2022-01-09 21:12:31 +01:00
|
|
|
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
|
2022-09-29 22:28:06 +02:00
|
|
|
readingTime {
|
|
|
|
text
|
|
|
|
}
|
2022-01-09 21:12:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
return result?.data?.allMarkdownRemark?.edges ?? [];
|
|
|
|
};
|
|
|
|
|
|
|
|
export default pagesQuery;
|