fix(blog): implement changes as per feedback

Co-Authored-By: mrjvs <mistrjvs@gmail.com>
This commit is contained in:
limes.pink
2025-04-16 17:07:48 +02:00
parent 1e25d24236
commit fbd9928003
3 changed files with 11 additions and 7 deletions

View File

@@ -4,6 +4,10 @@ const { data: post } = await useAsyncData(`blog-${slug}`, () => {
return queryCollection('blog').path(`/blog/${slug}`).first();
});
if (!post.value) {
throw createError({ statusCode: 404, statusMessage: 'Page Not Found' });
}
useHead({
title: `${post.value.title} | Pretendo Network Blog`,
meta: [
@@ -38,7 +42,7 @@ useHead({
<img
class="profile-picture"
:src="post.author_image"
:alt="post.author"
alt=""
>
<span>{{ post.author }}</span>
</div>

View File

@@ -2,9 +2,9 @@
/* eslint-disable vue/no-v-html -- we might wanna avoid this by rewriting the locales to use variables */
const { data: allPosts } = await useAsyncData('blog', () => queryCollection('blog').all());
const posts = allPosts.value?.filter(p => !p.path.startsWith('/blog/_')).sort((a, b) => {
const posts = computed(() => allPosts.value?.filter(p => !p.path.startsWith('/blog/_')).sort((a, b) => {
return new Date(b.date).getTime() - new Date(a.date).getTime();
});
}));
</script>
<template>
@@ -66,7 +66,7 @@ const posts = allPosts.value?.filter(p => !p.path.startsWith('/blog/_')).sort((a
<img
class="profile-picture"
:src="post.author_image"
:alt="post.author"
alt=""
>
<span>{{ post.author }}</span>
</div>

View File

@@ -24,8 +24,8 @@ export default defineEventHandler(async (event) => {
posts.forEach((post) => {
feed.addItem({
title: post.title,
id: post.path,
link: `https://pretendo.network/${post.path}`,
id: post.path,
link: `https://pretendo.network${post.path}`,
description: post.caption,
author: [
{
@@ -33,7 +33,7 @@ export default defineEventHandler(async (event) => {
}
],
date: new Date(post.date),
image: `https://pretendo.network/${post.cover_image}`
image: `https://pretendo.network${post.cover_image}`
});
});