rickvanlieshout.com/internal/gatsby/queries/metadata-query.ts

26 lines
467 B
TypeScript
Raw Normal View History

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;