feat: Add author to articles

This commit is contained in:
Jesse Wierzbinski 2025-01-17 18:15:55 +01:00
parent f85bc75145
commit 5fc72966dd
No known key found for this signature in database
4 changed files with 92 additions and 64 deletions

View file

@ -0,0 +1,20 @@
<template>
<div class="flex flex-col gap-2 justify-center items-center">
<p class="text-gray-400 text-xs font-semibold uppercase">Written by</p>
<div class="flex items-center gap-4 ring-white/20 ring-1 rounded py-1 px-2">
<nuxt-img :preload="true" format="webp" :src="avatar" alt="Author avatar" class="size-12 rounded" />
<div class="flex flex-col justify-center pr-1">
<h2 class="text font-bold text-gray-50">{{ name }}</h2>
<p class="text-gray-500 text-sm">{{ handle }}</p>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
defineProps<{
avatar?: string;
name: string;
handle?: string;
}>();
</script>

View file

@ -119,7 +119,7 @@ export default defineNuxtConfig({
]), ]),
), ),
image: { image: {
domains: ["images.pexels.com"], domains: ["images.pexels.com", "cpluspatch.com"],
}, },
sitemap: { sitemap: {
sources: [...getRouteRenderingPaths(), "/"], sources: [...getRouteRenderingPaths(), "/"],

View file

@ -61,5 +61,11 @@
"@types/markdown-it-container": "^2.0.10", "@types/markdown-it-container": "^2.0.10",
"tailwindcss": "^3.4.17" "tailwindcss": "^3.4.17"
}, },
"trustedDependencies": ["@biomejs/biome", "@parcel/watcher", "esbuild", "sharp", "vue-demi"] "trustedDependencies": [
"@biomejs/biome",
"@parcel/watcher",
"esbuild",
"sharp",
"vue-demi"
]
} }

View file

@ -3,10 +3,12 @@
<Title v-if="post.title" :created_at="post.created_at" :title="post.title" /> <Title v-if="post.title" :created_at="post.created_at" :title="post.title" />
<Image v-if="post.image" :image="post.image.url" :width="post.image.width" :height="post.image.height" :caption="post.image.credit" /> <Image v-if="post.image" :image="post.image.url" :width="post.image.width" :height="post.image.height" :caption="post.image.credit" />
<Content :body="body" /> <Content :body="body" />
<Author v-if="post.author" :avatar="post.author.image" :name="post.author.name" :handle="post.author.handle" class="mt-10" />
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import Author from "~/components/article/author.vue";
import Content from "~/components/article/content.vue"; import Content from "~/components/article/content.vue";
import Image from "~/components/article/image.vue"; import Image from "~/components/article/image.vue";
import Title from "~/components/article/title.vue"; import Title from "~/components/article/title.vue";