mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2024-12-27 23:38:07 +01:00
30 lines
581 B
TypeScript
30 lines
581 B
TypeScript
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>(`
|
|
{
|
|
allMarkdownRemark(filter: { frontmatter: { draft: { ne: true } } }) {
|
|
edges {
|
|
node {
|
|
fields {
|
|
slug
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`);
|
|
|
|
return result?.data?.allMarkdownRemark;
|
|
};
|
|
|
|
export default postsQuery;
|