add: first post, external posts, new comps

Add first post for monday, add external posts from other authors, add components for internal and external links
This commit is contained in:
webfussel 2025-07-11 09:13:06 +02:00
parent 427d9ae276
commit 0a481fee5e
19 changed files with 264 additions and 329 deletions

View file

@ -5,7 +5,7 @@
loading="lazy"
width="50"
height="50"
:srcset="imageSet.join(', ')"
:srcset="imageSet"
:src="initialImage"
aria-hidden="true"
:alt="`Profilbild von ${name}`"
@ -24,9 +24,10 @@ import { getImageSet, getInitialImage } from '../../utils/image'
type Props = {
name: string
date: string
img?: string
}
const { name, date } = defineProps<Props>()
const { name, date, img } = defineProps<Props>()
const formatter = new Intl.DateTimeFormat('de-DE', {
year: 'numeric',
@ -36,6 +37,13 @@ const formatter = new Intl.DateTimeFormat('de-DE', {
const dateFormatted = computed(() => formatter.format(new Date(date)))
const imageSet = getImageSet('/img/blog/authors/', name)
const initialImage = getInitialImage('/img/blog/authors/', name)
const imageSet = computed(() => {
if (img) return img
return getImageSet('/img/blog/authors/', name).join(', ')
})
const initialImage = computed(() => {
if (img) return img
return getInitialImage('/img/blog/authors/', name)
})
</script>

View file

@ -1,5 +1,5 @@
<template>
<NuxtLink :to="link" class="BlogCard z-2">
<NuxtLink :to="link" :external="isExternal" :target="isExternal ? '_blank' : '_self'" class="BlogCard z-2">
<div class="image">
<img :src="image" alt=" " aria-hidden="true"/>
</div>
@ -14,27 +14,16 @@
</p>
</main>
<footer>
<BlogAuthor :name="author.name" :date="date"/>
<BlogAuthor :name="author.name" :img="author.img" :date="date"/>
</footer>
</div>
</NuxtLink>
</template>
<script setup lang="ts">
import type { Category } from './types'
import type { BlogCard } from './types'
type Props = {
title: string
description: string
image: string
date: string
link: string
category: Category
author: {
name: string
}
}
defineProps<Props>()
const { link } = defineProps<BlogCard>()
const isExternal = computed(() => link.startsWith('http'))
</script>

View file

@ -18,6 +18,7 @@ const icons: Record<Category, string> = {
'tutorial': 'ph:lightbulb-duotone',
'news': 'ph:newspaper-duotone',
'freelancing': 'ph:laptop-duotone',
'extern': 'ph:repeat-duotone',
}
const icon = computed(() => icons[name] ?? 'ph:question-mark-duotone')

View file

@ -1 +1,14 @@
export type Category = 'story' | 'snippet' | 'tutorial' | 'news' | 'freelancing'
export type Category = 'story' | 'snippet' | 'tutorial' | 'news' | 'freelancing' | 'extern'
export type BlogCard = {
title: string
description: string
image: string
date: string
link: string
category: Category
author: {
name: string
img?: string
}
}