mirror of
https://github.com/quartz-community/og-image.git
synced 2026-07-22 02:50:23 +00:00
No description
The type was a deliberate narrowing of QuartzPluginData that documents which fields the og-image emitter populates before invoking a user's imageStructure callback (including the plugin-synthesised 'text' field). The old name implied accidental duplication, inviting 'helpful' future refactors that would inline it into QuartzPluginData and silently widen the public API. Rename to SocialImageFileData, export it from the package entry, and add a docstring explaining why it must stay narrow. The type was already visible in the generated .d.ts through ImageOptions, so making the export explicit matches what consumers already see in their IDE. Also adds a test suite (og-image previously had no tests): - SocialImageFileData contract tests locking in the documented shape - imageStructure callback signature compatibility - defaultImage called with populated / minimal / readingTimeText override payloads returns a valid preact VNode |
||
|---|---|---|
| .github/workflows | ||
| dist | ||
| src | ||
| test | ||
| types | ||
| .eslintrc.json | ||
| .gitignore | ||
| .prettierignore | ||
| .prettierrc | ||
| CHANGELOG.md | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| tsup.config.ts | ||
| vitest.config.ts | ||
@quartz-community/og-image
Generates Open Graph social preview images for each page using Satori and Sharp.
Installation
npx quartz plugin add github:quartz-community/og-image
Usage
plugins:
- source: github:quartz-community/og-image
enabled: true
For advanced use cases, you can override in TypeScript:
import * as ExternalPlugin from "./.quartz/plugins";
ExternalPlugin.CustomOgImages({
colorScheme: "lightMode",
width: 1200,
height: 630,
});
Configuration
| Option | Type | Default | Description |
|---|---|---|---|
colorScheme |
"lightMode" | "darkMode" |
"lightMode" |
The color scheme to use for the generated images. |
width |
number |
1200 |
The width of the generated images. |
height |
number |
630 |
The height of the generated images. |
excludeRoot |
boolean |
false |
Whether to exclude the root page from image generation. |
defaultTitle |
string |
"Untitled" |
The default title to use if a page has no title. |
defaultDescription |
string |
"No description provided" |
The default description to use if a page has no description. |
readingTimeText |
(minutes: number) => string |
undefined |
A function to format the reading time text. |
imageStructure |
function |
undefined |
A function to define the structure of the generated image. |
Documentation
See the Quartz documentation for more information.
License
MIT