I have a custom content type, ‘Article with Header’ for which I have a custom twig template, ‘page–article-with-header.html.twig’, which manages the layout for this content type. When I preview the node before publishing, the template used is page.html.twig. I would like to have the same layout for previewing as for when the node is published, but I don’t see any options for doing this. The template suggestions that come up in preview mode (page–node–preview.html, for example) would affect every content type.
Is there a naming convention for preview mode twig templates for custom content types that I’m missing? Is there a preprocessing function I can implement that will force the preview mode for this content type to use the correct template?
Sponsored by SupremePR