mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-08-20 07:36:54 -05:00
fix(blog): implement changes as per feedback
Co-Authored-By: mrjvs <mistrjvs@gmail.com>
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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}`
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user