crbtc.org/pages/guide/[slug].vue

28 lines
704 B
Vue

<script setup>
const { path } = useRoute()
const { data, error } = await useAsyncData(`content-${path}`, () => {
return queryContent().where({ _path: path }).findOne()
})
if (error.value) {
showError(
createError({
statusCode: 404,
statusMessage: 'Not Found',
})
)
}
</script>
<template>
<div class="guide" :id="data.slug">
<div class="hero">
<h3>{{ data.title }}</h3>
<p>Written by: {{ data.author }}</p>
<p v-if="data.updated < data.published">Updated: {{ data.updated }}</p>
<p v-if="data.published <= data.updated">Published: {{ data.published }}</p>
</div>
<ContentDoc class="content" />
</div>
</template>