You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 028cdd1
Browse filesBrowse the repository at this point in the historyBrowse files
feat(og-image): ✨ Enhance Open Graph image generation with new layout and branding features
- Refactored `DefaultOgImageTemplate` to improve layout handling and branding display.
- Introduced `OgGlow` and `OgBrand` components for better visual representation.
- Removed unused `icon` and `image` properties from `OgImageTemplateProps`.
- Updated related routes and types to reflect changes in Open Graph image handling.
- Improved overall styling and text presentation for better user experience.
Copy file name to clipboardExpand all lines: apps/web/content/docs/content-engine/seo.mdx
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,7 @@ delivery: {
70
70
|`noIndexField`| boolean, not localized |`robots` tag and sitemap, see [noindex](#hide-a-record-from-search-engines)|
71
71
|`openGraph.titleField`| text | Open Graph title, falls back to the page title |
72
72
|`openGraph.descriptionField`| text, textarea, richText | Open Graph description, falls back to the page description |
73
-
|`openGraph.imageField`| file, single, not localized | The cover behind the card, see [Social images](#social-images)|
73
+
|`openGraph.imageField`| file, single, not localized | The cover used as `og:image` with `generateImage: false`, see [Social images](#social-images)|
74
74
|`openGraph.generateImage`| boolean, default `true`|`false` uses the cover itself as `og:image`, see [Social images](#social-images)|
75
75
76
76
Every field you name must also be in `publicApi.fields`, because the page shows it to anyone. Leave one out and the definition throws at startup with `... which is not in publicApi.fields`. A field inside a group works (`"seo.title"`). A field inside a repeatable does not, since a page has one title, not a list of them.
@@ -117,8 +117,7 @@ The page's `head` calls `contentDeliveryPageHead` with the resolve route's answe
117
117
118
118
With `delivery.seo.openGraph` set, a record page gets an `og:image`, the picture link previews show. The API draws it as a 1200 × 630 card at `/delivery/og/{slug}`, next to the other delivery routes: the Open Graph description as a large quote, signed with the title. `openGraph: {}` is enough to get one.
119
119
120
-
-**A cover behind the card.**`openGraph.imageField` names a shared, single `field.file()` in `publicApi.fields`; the blog uses its cover. The card shows it on the right side, fading smoothly into the background, and keeps the quote in its own column so no word sits on the picture. Only an image a reader may open counts: a GIF, JPEG, PNG or WebP that no [attachment rule](/docs/content-engine/access-attachments) restricts. The API reads it from your storage, and a new cover gives the card a new URL.
121
-
-**The cover on its own.**`generateImage: false` skips the card and uses the `imageField` image itself as `og:image`, with the file's alt text in the page's language (the record's title when the file has none). A record without a cover then falls back to the site card, drawn with its title and description. The blog plugin works this way.
120
+
The card never draws pictures from the record, only text on the site's colours. To share a record's own cover instead, name it in `openGraph.imageField` and set `generateImage: false`: the field is a shared, single `field.file()` in `publicApi.fields`, and the image itself becomes `og:image`, with the file's alt text in the page's language (the record's title when the file has none). Only an image a reader may open counts: a GIF, JPEG, PNG or WebP that no [attachment rule](/docs/content-engine/access-attachments) restricts. A record without a cover then falls back to the site card, drawn with its title and description. The blog plugin works this way.
122
121
123
122
The resolve route reports the choice under `openGraph.image`:
When someone shares a VitNode link on Facebook, LinkedIn, X, Slack or Discord, the preview shows the page's `og:image`. VitNode fills it for you: the API draws a social card, and every page head points at it. The card is headed by the site's logo, with the page's title as the headline, its description underneath, and the page's cover, when it has one, on the right side, fading smoothly into the background beside the text. No headless browser runs, and nothing is fetched from the internet: the fonts ship with VitNode and covers come from your own storage.
10
+
When someone shares a VitNode link on Facebook, LinkedIn, X, Slack or Discord, the preview shows the page's `og:image`. VitNode fills it for you: the API draws a social card, and every page head points at it. The card is headed by the site's logo, with the page's title as the headline, its description underneath, and a soft glow of your accent colour lighting up the right side. No headless browser runs, and nothing is fetched from the internet: the fonts ship with VitNode.
11
11
12
12
<ImgDocs
13
13
src={cardExample}
14
-
alt="A dark social card with the VitNode logo at the top left, the story's excerpt as a large quote, and the title Hello Content Engine and the domain below it"
14
+
alt="A dark social card with the VitNode logo at the top left, the story's excerpt as a large quote, the title Hello Content Engine and the domain below it, and a soft blue glow on the right"
| A Content Engine record whose type sets `delivery.seo.openGraph`| Its card at `/api/{plugin}/content/{path}/delivery/og/{slug}`, with the [`imageField`](/docs/content-engine/seo#social-images) cover in the background|
22
-
| A member profile (`/users/{nameCode}`) | The member's card at `/api/@vitnode/core/og/users/{nameCode}`: name, profile headline and avatar, profile cover in the background|
21
+
| A Content Engine record whose type sets `delivery.seo.openGraph`| Its card at `/api/{plugin}/content/{path}/delivery/og/{slug}`|
22
+
| A member profile (`/users/{nameCode}`) | The member's card at `/api/@vitnode/core/og/users/{nameCode}`: name, profile headline and avatar |
23
23
| Any other page with a title | The site card at `/api/@vitnode/core/og/site`, drawn with the page's own `title` and `description` from the URL |
24
24
25
-
Give the site card a coloured label and an icon with `openGraph`:
25
+
Give the site card a coloured label with `openGraph`:
-`imageCategory` puts a label above the title, and its `color` (`#rrggbb`) tints the label, the icon and the bar at the bottom. VitNode's docs use it for the section a page lives in.
41
-
-`imageIcon` frames an icon in the top-right corner: SVG path data on Lucide's 24 × 24 grid, drawn as a stroke. Anything but plain path data is dropped, so the card never draws markup from the URL.
39
+
-`imageCategory` puts a label above the title, and its `color` (`#rrggbb`) tints the label, the glow and the bar at the bottom. VitNode's docs use it for the section a page lives in.
42
40
-`imageLayout: "quote"` swaps the headline for a pull quote: the description large, signed with the title.
43
41
44
42
A page with a title also gets `og:title`, `og:description`, `og:type`, `og:site_name`, `og:url` (its canonical URL), `og:locale` (as `en_US`, even when the locale is just `en`), one `og:locale:alternate` per other language it has `alternates` in, and the X card tags `twitter:card`, `twitter:title`, `twitter:description`, `twitter:image` and `twitter:image:alt`. A layout that only sets `robots` gets none of them.
The props are `title`, `description`, `siteName`, `domain`, `locale`, `theme`, `logo` and `kind` (`content`, `profile` or `site`), plus `contentTypeId` and `pluginId` on a content card, `avatar` on a profile card, and `image` (`{ src }`, a `data:` URI) when the record or member has a cover. `logo` is `{ src, width, height, wordmark }`, ready for an `<img>`. A template that puts the logo on a background other than `theme.background` recolors its `currentColor` with `ogImageLogoSrc(logo, "#18181b")` from `@vitnode/api/lib/og-image`.
192
+
The props are `title`, `description`, `siteName`, `domain`, `locale`, `theme`, `logo` and `kind` (`content`, `profile` or `site`), plus `contentTypeId` and `pluginId` on a content card and `avatar` on a profile card. `logo` is `{ src, width, height, wordmark }`, ready for an `<img>`. A template that puts the logo on a background other than `theme.background` recolors its `currentColor` with `ogImageLogoSrc(logo, "#18181b")` from `@vitnode/api/lib/og-image`.
195
193
196
194
A plugin registers templates for its own content types in `buildApiPlugin`:
0 commit comments