diff options
Diffstat (limited to 'packages/web/src/components')
| -rw-r--r-- | packages/web/src/components/Head.astro | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/web/src/components/Head.astro b/packages/web/src/components/Head.astro index 36f11c955..3d9bc0f53 100644 --- a/packages/web/src/components/Head.astro +++ b/packages/web/src/components/Head.astro @@ -7,13 +7,14 @@ import config from '../../config.mjs' const slug = Astro.url.pathname.replace(/^\//, "").replace(/\/$/, ""); const { entry: { - data: { title }, + data: { title , description }, }, } = Astro.locals.starlightRoute; const isDocs = slug.startsWith("docs") let encodedTitle = ''; let ogImage = `${config.url}/social-share.png`; +let truncatedDesc = ''; if (isDocs) { // Truncate to fit S3's max key size @@ -26,7 +27,12 @@ if (isDocs) { ) ) ); - ogImage = `${config.socialCard}/opencode-docs/${encodedTitle}.png`; + + if (description) { + truncatedDesc = encodeURIComponent(description.substring(0, 400)) + } + + ogImage = `${config.socialCard}/opencode-docs/${encodedTitle}.png?desc=${truncatedDesc}`; } --- |
