Configure
Copy example.config.php to config/placard.php. Settings → Plugins → Placard previews the card your config produces.
sections and entryTypes override any setting except defaultImagePath, keyed by handle. Entry types win over sections. styles are named overrides editors choose between per entry (see Styles).
return [
'position' => 'bottom',
'sections' => [
'artists' => [
'position' => 'middle',
'background' => ['colorField' => 'colour'],
],
],
'entryTypes' => [
'featuredArtist' => ['meta' => false],
],
];
Paths accept aliases (@root, @webroot) and env vars. The canvas is fixed at 1200×630, the size every platform recommends.
Fonts #
No commercial font is bundled. Inter (SIL OFL) is the default, in a weight per element: Bold title, Medium label, Regular description and meta.
Set fontPath to use your own font file throughout, or googleFont to use a Google Fonts family. An element's own fontPath or googleFont (see Elements) gives it a different font. The element's own font wins over the global one, and at each level a path wins over a Google font.
'googleFont' => 'Fraunces',
'title' => ['googleFont' => 'Playfair Display:900'],
'meta' => ['fontPath' => '@root/src/fonts/MyMono.woff2'],
Font files. TTF, OTF, WOFF and WOFF2 all work. WOFF2 needs ImageMagick's FreeType built with Brotli, as current Debian and Ubuntu packages are. A file is one weight, so fontPath uses the same weight everywhere: give the title its own fontPath for a bolder one. A variable font draws in its default instance only.
Google Fonts. Give a family exactly as it's named on Google Fonts, with its capitals and spaces (Playfair Display, not playfair display or PlayfairDisplay), optionally with a weight: Fraunces or Fraunces:700. Without a weight, each element takes Inter's (700 title, 500 label, 400 description and meta), or 400 when the family doesn't have that weight. Variable families come as a static font at the weight you ask for. Each family and weight is downloaded once, from the server rather than visitors' browsers, into storage/runtime/placard/fonts/. Clear it with Utilities → Caches → Placard Google Fonts to pick up an updated family. A few families with axes besides weight, like Roboto Flex, aren't offered as one file: download those and use fontPath.
A font that can't be drawn (a missing or unreadable file, or a Google family that doesn't exist) falls back to Inter, and the reason goes to Craft's log. If Google can't be reached, the card is drawn in Inter but not cached, so it's drawn again with the font once the download works.
Nested fields #
Settings that name a field (imageFieldHandles, the background's imageField and every colorField) also take a path into a Matrix or Content Block field. seo.seoImage reads seoImage from the entries in seo and uses the first one with a value. Paths can go more than one level deep.
'imageFieldHandles' => ['seo.seoImage', 'hero'],
'background' => ['colorField' => 'seo.colour'],
Card text templates reach nested fields themselves: '{seo.one().seoTitle ?? title}'.