diff --git a/src/pages/[roadmapId]/index.astro b/src/pages/[roadmapId]/index.astro index e30851491..dd4766915 100644 --- a/src/pages/[roadmapId]/index.astro +++ b/src/pages/[roadmapId]/index.astro @@ -55,14 +55,21 @@ if (roadmapData.schema) { if (roadmapFAQs.length) { jsonLdSchema.push(generateFAQSchema(roadmapFAQs)); } + +const ogImageUrl = + roadmapData?.seo?.ogImageUrl || + `${import.meta.env.PUBLIC_API_URL}/v1-open-graph?${new URLSearchParams({ + type: 'roadmap', + title: roadmapData.title, + description: roadmapData.description, + })}`; --- diff --git a/src/pages/backend/languages.astro b/src/pages/backend/languages.astro index 95a4a5a20..fe33e326f 100644 --- a/src/pages/backend/languages.astro +++ b/src/pages/backend/languages.astro @@ -7,7 +7,17 @@ import { getGuideById } from '../../lib/guide'; const guideId = 'backend-languages'; const guide = await getGuideById('backend-languages'); -const { frontmatter: guideData } = guide; +const { frontmatter: guideData, author } = guide!; + +const ogImageUrl = `${import.meta.env.PUBLIC_API_URL}/v1-open-graph?${new URLSearchParams( + { + type: 'guide', + title: guideData.title, + description: guideData.description, + authorName: author.frontmatter?.name, + authorAvatar: author.frontmatter?.imageUrl || '', + }, +)}`; --- - +
diff --git a/src/pages/best-practices/[bestPracticeId]/index.astro b/src/pages/best-practices/[bestPracticeId]/index.astro index ede49870b..d54c9a384 100644 --- a/src/pages/best-practices/[bestPracticeId]/index.astro +++ b/src/pages/best-practices/[bestPracticeId]/index.astro @@ -52,12 +52,21 @@ if (bestPracticeData.schema) { }), ); } + +const ogImageUrl = `${import.meta.env.PUBLIC_API_URL}/v1-open-graph?${new URLSearchParams( + { + type: 'roadmap', + title: bestPracticeData.title, + description: bestPracticeData.description, + }, +)}`; ---