rickvanlieshout.com/internal/gatsby/queries/metadata-query.ts
2022-04-16 14:53:32 +00:00

26 lines
467 B
TypeScript

import { CreatePagesArgs } from "gatsby";
interface MetadataQueryResult {
site: {
siteMetadata: {
postsLimit?: number;
};
};
}
const metadataQuery = async (graphql: CreatePagesArgs["graphql"]) => {
const result = await graphql<MetadataQueryResult>(`
query SiteMetaData {
site {
siteMetadata {
postsLimit
}
}
}
`);
return result?.data?.site.siteMetadata ?? {};
};
export default metadataQuery;