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 d8c4b53
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: apps/web/content/docs/content-engine/seo.mdx
+43-13Lines changed: 43 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
---
2
2
title: SEO
3
-
description: Set the title, meta description, noindex, hreflang and sitemap entries of VitNode Content Engine record pages with delivery.seo and delivery.sitemap.
3
+
description: Set the title, meta description, social image, noindex, hreflang and sitemap entries of VitNode Content Engine record pages with delivery.seo and delivery.sitemap.
Once a content type has [public pages](/docs/content-engine/public-pages), `delivery.seo` decides which fields fill each page's `<title>`, meta description and `robots` tag, and `delivery.sitemap` lists the pages for crawlers. You name fields; the Content Engine reads them from every published record, so editors never fill in a separate SEO form unless you give them one.
10
+
Once a content type has [public pages](/docs/content-engine/public-pages), `delivery.seo` decides which fields fill each page's `<title>`, meta description, Open Graph tags and `robots` tag, and `delivery.sitemap` lists the pages for crawlers. You name fields; the Content Engine reads them from every published record, so editors never fill in a separate SEO form unless you give them one.
11
11
12
12
The examples use `newsroom.story` from the newsroom plugin and `blog.post` from the blog plugin, which is localized.
13
13
@@ -70,6 +70,8 @@ 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 used as `og:image` with `generateImage: false`, see [Social images](#social-images)|
74
+
|`openGraph.generateImage`| boolean, default `true`|`false` uses the cover itself as `og:image`, see [Social images](#social-images)|
73
75
74
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.
@@ -97,19 +100,43 @@ The blog plugin's own article editor checks the fields this rule reads in its **
97
100
98
101
## What reaches the page head
99
102
100
-
The page's `head` calls `contentDeliveryPageHead` with the resolve route's answer, as shown in [Write the page](/docs/content-engine/public-pages#write-the-page). This is what the HTML gets today:
103
+
The page's `head` calls `contentDeliveryPageHead` with the resolve route's answer, as shown in [Write the page](/docs/content-engine/public-pages#write-the-page). This is what the HTML gets:
|`<title>`| Yes, followed by the site title (`- VitNode`) |
108
+
|`<meta name="description">`| Yes, at most 160 characters |
109
+
|`<meta name="robots">`| Only for a no-index record |
110
+
|`<link rel="canonical">`| Yes. A localized type adds the `hreflang` links |
111
+
|`og:title`, `og:description`, `og:type`| Yes, `og:type` is `article`. From `openGraph` when set, else the page's |
112
+
|`og:url`, `og:site_name`, `og:locale`| Yes |
113
+
|`og:image` and its size, type and alt | Yes, see [Social images](#social-images)|
114
+
|`twitter:card`|`summary_large_image` with an image, `summary` without |
109
115
110
-
<Callouttype="warn">
111
-
The resolve route returns `openGraph` and `canonicalPath` for every record, but nothing turns them into tags yet. A nonlocalized type such as `newsroom.story` gets no canonical link, and no content type gets Open Graph tags. A plugin page cannot add them either, because its `head` only accepts `title`, `description`, `robots` and `alternates`. Keep `openGraph` in your definition so the data is ready, and read it from the resolve route if you render pages outside VitNode.
112
-
</Callout>
116
+
## Social images
117
+
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
+
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.
121
+
122
+
The resolve route reports the choice under `openGraph.image`:
123
+
124
+
```json
125
+
"openGraph": {
126
+
"title": "Hello Content Engine",
127
+
"description": "A first story from the newsroom plugin, served by the public API and rendered on its own page.",
The same page also carries the `og:*` tags and `twitter:card` from [What reaches the page head](#what-reaches-the-page-head).
299
+
270
300
Run the same command for `http://localhost:3000/blog/article/english-title` and you get its title, description and the four links from [Localized alternates](#localized-alternates-and-hreflang). The SVG logo's `<title>Logo VitNode</title>` may show up too; it is not page metadata.
271
301
272
302
Then ask the resolve route what the page was given, `openGraph` and `robots` included:
|`i18n`| object | Yes | - | Languages and locale routing. See [Languages & Localization](/docs/dev/i18n)|
59
-
|`metadata`| object | Yes | - | Site title, used in page titles as `{page} - {shortTitle ?? title}`|
59
+
|`metadata`| object | Yes | - | Site title, used in page titles as `{page} - {shortTitle ?? title}`. `metadata.ogImage` sets the default social image and `metadata.twitterSite` the X handle, see [Social images](/docs/dev/social-images)|
60
60
|`plugins`|`buildPlugin()` results | Yes | - | The installed plugins' frontend factories. See [Enabled plugins](#enabled-plugins)|
61
61
|`editor`| object | No | - | Settings shared by every `Editor` in the app |
62
62
|`logo`| component | No | VitNode logo | The header logo. See [Logo](#logo)|
Copy file name to clipboardExpand all lines: apps/web/content/docs/dev/routing/route-module.mdx
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,8 +79,10 @@ Throw `notFound()` or `redirect()` from `@tanstack/react-router` to answer with
79
79
|`description`|`string`| The `<meta name="description">`. |
80
80
|`robots`|`'index, follow' \| 'noindex, follow' \| 'noindex, nofollow'`| What a crawler may do. `noindex, follow` keeps a filtered list out of the index while its links still count. |
81
81
|`alternates`|`Record<string, string>`| Internal paths of the page in each language, for canonical and `hreflang` links. See [Advanced localized URLs](/docs/dev/i18n/localized-urls-advanced#hreflang-and-canonical-links). |
82
+
|`canonical`|`string`| The canonical URL, absolute or a path on the site, for a page without `alternates`. Also becomes `og:url`. |
83
+
|`openGraph`|`{ title?, description?, type?, image? }`| Overrides for link previews. `type` is `article`, `profile` or `website` (the default). `image` is `{ url, width?, height?, type?, alt? }`. See [Social images](/docs/dev/social-images). |
82
84
83
-
Return only these fields. VitNode turns them into the full set of tags with the app's site metadata.
85
+
Return only these fields. VitNode turns them into the full set of tags with the app's site metadata. A page with a `title` also gets Open Graph and `twitter:card` tags, with the site's [social image](/docs/dev/social-images) when it sets no `openGraph.image`.
0 commit comments