Skip to content

Commit ada0743

Browse files
committed
fix og:images on blog
1 parent 98dcc43 commit ada0743

7 files changed

+26
-2
lines changed

opensaas-sh/blog/astro.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export default defineConfig({
5050
components: {
5151
SiteTitle: './src/components/MyHeader.astro',
5252
ThemeSelect: './src/components/MyThemeSelect.astro',
53+
Head: './src/components/HeadWithOGImage.astro',
5354
},
5455
social: {
5556
github: 'https://github.com/wasp-lang/open-saas',
63.4 KB
Loading
45.5 KB
Loading
45.5 KB
Loading
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
import type { Props } from '@astrojs/starlight/props'
3+
import Default from '@astrojs/starlight/components/Head.astro'
4+
5+
// Get the URL of the generated image for the current page using its
6+
// ID and replace the file extension with `.png`.
7+
const ogImageUrl = new URL(
8+
`/og-images/${Astro.props.id.replace(/blog\//, '').replace(/\.\w+$/, '.webp')}`,
9+
'https://docs.opensaas.sh',
10+
)
11+
console.log(Astro.props)
12+
---
13+
14+
<!-- Render the default <Head/> component. -->
15+
<Default {...Astro.props}><slot /></Default>
16+
17+
<!-- Render the <meta/> tags for the Open Graph images. -->
18+
<meta property="og:image" content={ogImageUrl} />
19+
<meta name="twitter:image" content={ogImageUrl} />

opensaas-sh/blog/src/content/docs/blog/2024-10-10-most-annoying-cookie-banner-contest.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
title: 🍪 THE MOST ANNOYING COOKIE BANNER EVER HACKATHON 🤬
33
date: 2024-10-10
44
tags: ["cookie consent", "saas", "sideproject", "hackathon"]
5-
image: "/cookie-consent/annoying-cookie-banners.jpg"
5+
cover:
6+
alt: Annoying Cookie Banner Contest
7+
image: "/cookie-consent/annoying-cookie-banners.jpg"
68
---
79
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
810
<iframe

opensaas-sh/blog/src/content/docs/blog/2024-11-22-best-annoying-cookie-consent-banners.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
title: We Made the Most Annoying Cookie Banners Ever
33
date: 2024-11-26
44
tags: ["cookie consent", "saas", "sideproject", "hackathon"]
5-
image: "/cookie-consent/annoying-cookie-banners.jpg"
5+
cover:
6+
alt: the Most Annoying Cookie Banners
7+
image: "/cookie-consent/annoying-cookie-banners.jpg"
68
---
79
import VideoPlayer from '../../../components/VideoPlayer.astro';
810

0 commit comments

Comments
 (0)