Implement og image override and fix canonical urls

pull/5563/head
Kamran Ahmed 7 months ago
parent 3a1b896eb2
commit f173220966
  1. 1
      src/lib/guide.ts
  2. 2
      src/pages/backend/developer-skills.astro
  3. 2
      src/pages/backend/developer-tools.astro
  4. 2
      src/pages/backend/languages.astro
  5. 6
      src/pages/guides/[guideId].astro

@ -14,6 +14,7 @@ export interface GuideFrontmatter {
}; };
isNew: boolean; isNew: boolean;
type: 'visual' | 'textual'; type: 'visual' | 'textual';
ogImageUrl?: string;
date: string; date: string;
sitemap: { sitemap: {
priority: number; priority: number;

@ -19,7 +19,7 @@ const ogImageUrl = getOpenGraphImageUrl({
<BaseLayout <BaseLayout
title={guideData.seo.title} title={guideData.seo.title}
description={guideData.seo.description} description={guideData.seo.description}
permalink={`/backend/${guideId}`} permalink={`/backend/developer-skills`}
canonicalUrl={guideData.canonicalUrl} canonicalUrl={guideData.canonicalUrl}
ogImageUrl={ogImageUrl} ogImageUrl={ogImageUrl}
> >

@ -19,7 +19,7 @@ const ogImageUrl = getOpenGraphImageUrl({
<BaseLayout <BaseLayout
title={guideData.seo.title} title={guideData.seo.title}
description={guideData.seo.description} description={guideData.seo.description}
permalink={`/backend/${guideId}`} permalink={`/backend/developer-tools`}
canonicalUrl={guideData.canonicalUrl} canonicalUrl={guideData.canonicalUrl}
ogImageUrl={ogImageUrl} ogImageUrl={ogImageUrl}
> >

@ -22,7 +22,7 @@ const ogImageUrl = getOpenGraphImageUrl({
<BaseLayout <BaseLayout
title={guideData.seo.title} title={guideData.seo.title}
description={guideData.seo.description} description={guideData.seo.description}
permalink={`/backend/${guideId}`} permalink={`/backend/languages`}
canonicalUrl={guideData.canonicalUrl} canonicalUrl={guideData.canonicalUrl}
ogImageUrl={ogImageUrl} ogImageUrl={ogImageUrl}
> >

@ -24,10 +24,12 @@ const { guideId } = Astro.params;
const { guide } = Astro.props; const { guide } = Astro.props;
const { frontmatter: guideData, author } = guide; const { frontmatter: guideData, author } = guide;
const ogImageUrl = getOpenGraphImageUrl({ const ogImageUrl =
guideData.ogImageUrl ||
getOpenGraphImageUrl({
group: 'guides', group: 'guides',
resourceId: guideId, resourceId: guideId,
}); });
--- ---
<BaseLayout <BaseLayout

Loading…
Cancel
Save