Skip to content

Commit 7556242

Browse files
committed
fix: switch default meta.image to .png
1 parent 6e1edc1 commit 7556242

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/astro/src/default/components/MetaTags.astro

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ import { readPublicAsset } from '../utils/publicAsset';
66
interface Props {
77
meta?: MetaTagsConfig;
88
}
9+
10+
const DEFAULT_OG_IMAGE = 'https://tutorialkit.dev/tutorialkit-opengraph.png';
11+
912
const { meta = {} } = Astro.props;
1013
let imageUrl = meta.image;
1114
15+
// Resolve relative paths to /public folder
1216
if (imageUrl?.startsWith('/') || imageUrl?.startsWith('.')) {
1317
imageUrl = readPublicAsset(imageUrl, true);
1418
@@ -17,10 +21,12 @@ if (imageUrl?.startsWith('/') || imageUrl?.startsWith('.')) {
1721
}
1822
}
1923
20-
imageUrl ??= readLogoFile('logo', true);
24+
imageUrl ??= readLogoFile(DEFAULT_OG_IMAGE, true);
25+
2126
if (imageUrl?.endsWith('.svg')) {
22-
console.warn(`Using a SVG open graph image "${imageUrl}". This is not supported by most social platforms.
23-
You should rather set "meta.image" to a raster image (PNG, WEBP).`);
27+
console.warn(
28+
`Using a SVG open graph image "${imageUrl}". This is not supported by most social platforms. You should rather set "meta.image" to a raster image (PNG, WEBP).`,
29+
);
2430
}
2531
---
2632

0 commit comments

Comments
 (0)