- posts.author_id 마이그레이션 및 owner/admin 단일 계정 환경에서만 기존 글 backfill - 공개 상세: 글쓴이 본인일 때만 공유 옆 수정 링크 표시, 수정 시각 제거 - 목록 요약: excerpt 없을 때 본문 fallback, post-summary-clamp로 말줄임 처리 - 회원 세션 API에 isAdmin·role 추가
35 lines
972 B
Vue
35 lines
972 B
Vue
<script setup>
|
|
const { data: posts } = await useFetch('/api/posts', {
|
|
default: () => []
|
|
})
|
|
|
|
const postCards = computed(() => posts.value.map((post) => ({
|
|
title: post.title,
|
|
excerpt: createPostSummary(post.excerpt, post.content, {
|
|
maxLength: 320,
|
|
appendEllipsis: false
|
|
}),
|
|
featuredImage: post.featuredImage,
|
|
tag: post.tags?.[0] ? String(post.tags[0]).toUpperCase() : '',
|
|
publishedAt: formatPostDate(post.publishedAt),
|
|
to: `/post/${post.slug}`
|
|
})))
|
|
</script>
|
|
|
|
<template>
|
|
<MainColumn>
|
|
<section class="posts-index site-section">
|
|
<div class="posts-index__header site-section-header">
|
|
<p class="posts-index__eyebrow text-xs font-semibold uppercase text-muted">
|
|
Posts
|
|
</p>
|
|
<h1 class="posts-index__title mt-3 text-4xl font-semibold leading-tight">
|
|
게시물
|
|
</h1>
|
|
</div>
|
|
</section>
|
|
|
|
<PostCard v-for="post in postCards" :key="post.to" :post="post" />
|
|
</MainColumn>
|
|
</template>
|