- journal module registers the Journal pages at journal.routes paths - typed anonymous-GET client, html gate, SSR x-forwarded-for forwarding - fixture API, built-server SSR smoke and git-tag install check
22 lines
702 B
Vue
22 lines
702 B
Vue
<script setup lang="ts">
|
|
// journal-tag: posts with one tag; an unknown tag is a 404.
|
|
const route = useRoute()
|
|
const api = useJournalApi()
|
|
const slug = String(route.params.tag ?? '')
|
|
const { data } = await useAsyncData(`journal-tag-${slug}`, async () => {
|
|
const tag = (await api.listTags()).find((t) => t.slug === slug)
|
|
if (!tag) return null
|
|
return { tag, page: await api.listPosts({ tag: tag.slug }) }
|
|
})
|
|
if (!data.value) throw createError({ statusCode: 404, fatal: true })
|
|
</script>
|
|
|
|
<template>
|
|
<section v-if="data" class="journal-tag">
|
|
<h1>{{ data.tag.name }}</h1>
|
|
<ul>
|
|
<li v-for="post in data.page.data" :key="post.id">{{ post.title }}</li>
|
|
</ul>
|
|
</section>
|
|
</template>
|