Skip to content

Commit d39bf40

Browse files
authored
fix: switch default meta.image to .png (#427)
1 parent 6e1edc1 commit d39bf40

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

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

+10-4
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,27 @@ 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
1519
if (!imageUrl) {
16-
console.warn(`Image ${meta.image} not found in "/public" folder`);
20+
console.warn(`\nImage ${meta.image} not found in "/public" folder`);
1721
}
1822
}
1923
20-
imageUrl ??= readLogoFile('logo', true);
24+
imageUrl ??= DEFAULT_OG_IMAGE;
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+
`\nUsing 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)