Skip to content

Commit bd250e7

Browse files
committed
chore: add og-image to release post
1 parent fc61793 commit bd250e7

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

app/components/global/BlogPostWrapper.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ useSeoMeta({
1515
ogTitle: props.frontmatter.title,
1616
ogDescription: props.frontmatter.description || props.frontmatter.excerpt,
1717
ogType: 'article',
18+
ogImage: props.frontmatter.image,
1819
...(props.frontmatter.draft ? { robots: 'noindex, nofollow' } : {}),
1920
})
2021
@@ -27,11 +28,13 @@ useHead({
2728
],
2829
})
2930
30-
defineOgImageComponent('BlogPost', {
31-
title: props.frontmatter.title,
32-
authors: post.value?.authors ?? [],
33-
date: props.frontmatter.date,
34-
})
31+
if (!props.frontmatter.image) {
32+
defineOgImageComponent('BlogPost', {
33+
title: props.frontmatter.title,
34+
authors: post.value?.authors ?? [],
35+
date: props.frontmatter.date,
36+
})
37+
}
3538
3639
const slug = computed(() => props.frontmatter.slug)
3740

app/pages/blog/release/0.8.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ tags: ['OpenSource', 'Release']
1111
excerpt: "Today we're releasing npmx 0.8 – including a new command palette and a lot of other features."
1212
date: '2026-04-08'
1313
slug: 'release/0.8'
14+
image: 'https://npmx.dev/blog/og/release-0_8.png'
1415
description: "Today we're releasing npmx 0.8 – including a new command palette and a lot of other features."
1516
draft: false
1617
---

public/blog/og/release-0_8.png

395 KB
Loading

shared/schemas/blog.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export const RawBlogPostSchema = object({
4545
excerpt: optional(string()),
4646
tags: optional(array(string())),
4747
draft: optional(boolean()),
48+
image: optional(string()),
4849
})
4950

5051
/** Schema for blog post frontmatter with resolved author data (avatars, profile URLs) */
@@ -58,6 +59,7 @@ export const BlogPostSchema = object({
5859
excerpt: optional(string()),
5960
tags: optional(array(string())),
6061
draft: optional(boolean()),
62+
image: optional(string()),
6163
})
6264

6365
export type Author = InferOutput<typeof AuthorSchema>

0 commit comments

Comments
 (0)