Files
mariosant.dev/pages/articles/[...slug].vue
2025-09-21 12:42:31 +03:00

88 lines
1.9 KiB
Vue

<script setup lang="ts">
import { formatDate } from "@vueuse/core";
definePageMeta({
layout: "content",
});
const { path } = useRoute();
const { data: article } = useAsyncData(path, async () => {
const article = await queryCollection("articles").path(path).first();
return article;
});
</script>
<template>
<UContainer
v-motion-fade
class="flex flex-col gap-3 prose max-w-3xl dark:prose-invert p-4 sm:p-6 lg:p-8"
as="article"
>
<div class="text-sm text-slate-500">
{{ formatDate(new Date(article.date), "Do of MMMM YYYY") }}
</div>
<h1 class="text-3xl md:text-4xl font-bold">{{ article.title }}</h1>
</UContainer>
<UContainer
class="hidden md:block max-w-3xl p-4 sm:p-6 lg:p-8"
as="figure"
v-if="article.coverImage?.url"
v-motion-fade
:delay="500"
>
<NuxtImg
placeholder
:src="article.coverImage?.url ?? ''"
:alt="article.title"
height="1000"
width="1700"
class="rounded-lg"
/>
<ULink
v-if="article.coverImage.authorUrl"
:to="article.coverImage.authorUrl"
target="_blank"
class="text-xs text-slate-500 italic font-serif hover:underline p-4 sm:p-6 lg:p-8"
>
Photo by {{ article.coverImage.author }}
</ULink>
</UContainer>
<UContainer
v-motion-fade
:delay="500"
class="flex flex-col gap-3 prose dark:prose-invert !pt-0 max-w-3xl p-4 sm:p-6 lg:p-8"
as="article"
>
<ContentRenderer :value="article" prose />
</UContainer>
<UContainer
v-motion-fade
:delay="500"
class="flex flex-col gap-3 prose dark:prose-invert !pt-0 max-w-3xl p-4 sm:p-6 lg:p-8"
>
<hr class="border border-slate-100" />
</UContainer>
<ArticlesAboutAuthor v-motion-fade :delay="500" />
<Footer v-motion-fade :delay="500" />
</template>
<style scoped>
article.prose {
h2 {
font-weight: bold !important;
a {
font-weight: bold !important;
}
}
}
</style>
s