feat(og): add post description to OG image

finxol.io efd83328 37eaf6f4

verified
Changed files
+16 -4
app
components
OgImage
pages
+10 -4
app/components/OgImage/Post.vue
···
title: string;
date: string;
author: string;
}>();
-
const { title, date, author } = props;
</script>
<template>
<div class="h-full w-full flex items-start justify-start bg-stone-100">
<div class="flex items-start justify-start h-full">
<div class="flex flex-col justify-between w-full h-full px-30 py-15" style="font-family: 'Recoleta'">
-
<h1 class="text-[90px] text-left">
-
{{ title }}
-
</h1>
<div class="flex flex-row items-center justify-between text-4xl font-bold mb-0">
<div class="flex flex-row items-center gap-8">
<img src="/logo.png" alt="Author Avatar" height="56" width="56">
···
title: string;
date: string;
author: string;
+
description: string;
}>();
+
const { title, date, author, description } = props;
</script>
<template>
<div class="h-full w-full flex items-start justify-start bg-stone-100">
<div class="flex items-start justify-start h-full">
<div class="flex flex-col justify-between w-full h-full px-30 py-15" style="font-family: 'Recoleta'">
+
<div>
+
<h1 class="text-[80px] text-left">
+
{{ title }}
+
</h1>
+
<p class="text-[30px] text-left line-clamp-3 text-ellipsis" style="font-family: 'Orkney Regular'">
+
{{ description }}
+
</p>
+
</div>
<div class="flex flex-row items-center justify-between text-4xl font-bold mb-0">
<div class="flex flex-row items-center gap-8">
<img src="/logo.png" alt="Author Avatar" height="56" width="56">
+1
app/pages/posts/[...slug].vue
···
if (post.value) {
defineOgImageComponent("Post", {
title: post.value.title,
date: post.value.date,
author: post.value.authors[0]?.name
});
···
if (post.value) {
defineOgImageComponent("Post", {
title: post.value.title,
+
description: post.value.description,
date: post.value.date,
author: post.value.authors[0]?.name
});
+5
nuxt.config.ts
···
name: "Recoleta",
weight: 700,
path: "/fonts/recoleta-bold.ttf"
}
]
},
···
name: "Recoleta",
weight: 700,
path: "/fonts/recoleta-bold.ttf"
+
},
+
{
+
name: "Orkney Regular",
+
weight: 700,
+
path: "/fonts/orkney-regular.ttf"
}
]
},