feat: fill pages
All checks were successful
Publish Docker Images / build-and-publish (push) Successful in 10m25s

This commit is contained in:
2025-11-11 19:12:21 +01:00
parent 3f828a754b
commit fceeb5307c
38 changed files with 634 additions and 65 deletions

View File

@@ -0,0 +1,35 @@
<template>
<NuxtLayout v-if="page" :name="page.meta?.layout ?? 'default'">
<ContentRenderer :value="page" />
</NuxtLayout>
<div v-else>
<h1>Page not found</h1>
<p>This page doesn&apos;t exist in {{ locale }} language.</p>
</div>
</template>
<script setup lang="ts">
import { withLeadingSlash } from 'ufo';
import type { Collections } from '@nuxt/content';
const route = useRoute();
const { locale } = useI18n();
const slug = computed(() => withLeadingSlash(String(route.params.slug)));
const { data: page } = await useAsyncData(
'page-' + slug.value,
async () => {
const collection = ('content_' + locale.value) as keyof Collections;
const content = await queryCollection(collection).path(slug.value).first();
if (!content && locale.value !== 'en') {
return await queryCollection('content_en').path(slug.value).first();
}
return content;
},
{
watch: [locale], // Refresh when locale changes
},
);
useMeta({ title: page.value?.title, description: page.value?.description });
</script>