Most, if not all, page meta is generated via getGenerateMetadata located at src/lib/cms/getGenerateMetadata.ts. This function fetches meta from Dato for the specific page it is called from and returns it as a Metadata object.
GraphQL Query
There is a GraphQL query to be used in getGenerateMetadata for each page type. See examples in src/graphql/Page.graphql and src/graphql/Article.graphql.
Usage
In any page.tsx file, export the generateMetadata function like this:
export const generateMetadata = getGenerateMetadata({
document: PageMetaDocument, // Change to the meta graphql query for the page
});The result will be that any SEO data set in Dato will be used for the page, like title, description, preview image, etc.
Safeguard - allow indexing
There is an additional safeguard to prevent accidental indexing of pages before launch, via the environment variable DATO_CONTROLLED_ROBOTS_CONFIG_ENABLED. Once the site is ready to be launched and pages indexed this should be set to true in Vercel.