mirror of
				https://github.com/mastermindzh/rickvanlieshout.com
				synced 2025-11-04 02:29:46 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			35 lines
		
	
	
		
			688 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			688 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 }, template: { eq: "post" } } }
 | 
						|
      ) {
 | 
						|
        edges {
 | 
						|
          node {
 | 
						|
            fields {
 | 
						|
              slug
 | 
						|
              readingTime {
 | 
						|
                text
 | 
						|
              }
 | 
						|
            }
 | 
						|
          }
 | 
						|
        }
 | 
						|
      }
 | 
						|
    }
 | 
						|
  `);
 | 
						|
 | 
						|
  return result?.data?.allMarkdownRemark;
 | 
						|
};
 | 
						|
 | 
						|
export default postsQuery;
 |