2022-01-09 21:12:31 +01:00
|
|
|
import { CreatePagesArgs } from "gatsby";
|
|
|
|
|
|
|
|
import * as types from "../types";
|
|
|
|
|
|
|
|
export interface PostsQueryResult {
|
|
|
|
allMarkdownRemark: {
|
|
|
|
edges?: Array<types.Edge>;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
const postsQuery = async (graphql: CreatePagesArgs["graphql"]) => {
|
|
|
|
const result = await graphql<PostsQueryResult>(`
|
|
|
|
{
|
2022-09-17 23:16:13 +02:00
|
|
|
allMarkdownRemark(
|
|
|
|
filter: { frontmatter: { draft: { ne: true }, template: { eq: "post" } } }
|
|
|
|
) {
|
2022-01-09 21:12:31 +01:00
|
|
|
edges {
|
|
|
|
node {
|
|
|
|
fields {
|
|
|
|
slug
|
2022-09-29 22:28:06 +02:00
|
|
|
readingTime {
|
|
|
|
text
|
|
|
|
}
|
2022-01-09 21:12:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
return result?.data?.allMarkdownRemark;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default postsQuery;
|