@sit-onyx/nuxt-docs 0.8.1-dev-20261123100908 → 0.8.1-dev-20261124091709
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -38,17 +38,9 @@ export const useCollection = async <TCollection extends keyof Collections = keyo
|
|
|
38
38
|
|
|
39
39
|
const key = computed(() => `collection-${collection.value}-${path.value}`);
|
|
40
40
|
|
|
41
|
-
return useAsyncData(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
throw createError({ status: 404, message: "Page not found", fatal: true });
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
// when multiple parallel requests are made for the same page, "defer" will make sure only the first
|
|
50
|
-
// is executed and the result is shared with all other requests
|
|
51
|
-
dedupe: "defer",
|
|
52
|
-
},
|
|
53
|
-
);
|
|
41
|
+
return useAsyncData(key, () => queryCollection(collection.value).path(path.value).first(), {
|
|
42
|
+
// when multiple parallel requests are made for the same page, "defer" will make sure only the first
|
|
43
|
+
// is executed and the result is shared with all other requests
|
|
44
|
+
dedupe: "defer",
|
|
45
|
+
});
|
|
54
46
|
};
|
package/app/pages/[...slug].vue
CHANGED
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { Collections } from "@nuxt/content";
|
|
3
|
-
import type { NuxtLayouts } from "#app";
|
|
3
|
+
import type { NuxtError, NuxtLayouts } from "#app";
|
|
4
4
|
|
|
5
5
|
definePageMeta({ layout: false });
|
|
6
6
|
|
|
7
7
|
const { locale } = useI18n();
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const error = ref<NuxtError>();
|
|
10
|
+
|
|
11
|
+
const { data, error: collectionError } = await useCollection({
|
|
10
12
|
collection: computed(() => `content_${locale.value}` as keyof Collections),
|
|
11
13
|
});
|
|
12
14
|
|
|
15
|
+
watch(
|
|
16
|
+
[data, collectionError],
|
|
17
|
+
() => {
|
|
18
|
+
if (collectionError.value) {
|
|
19
|
+
error.value = collectionError.value;
|
|
20
|
+
} else if (!data.value) {
|
|
21
|
+
error.value = createError({ status: 404, message: "Page not found", fatal: true });
|
|
22
|
+
} else {
|
|
23
|
+
error.value = undefined;
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{ immediate: true },
|
|
27
|
+
);
|
|
28
|
+
|
|
13
29
|
useSeoMeta({
|
|
14
30
|
title: () => data.value?.seo.title,
|
|
15
31
|
description: () => data.value?.seo.description,
|
|
@@ -24,7 +40,7 @@ const layout = computed<keyof NuxtLayouts>(() => {
|
|
|
24
40
|
|
|
25
41
|
<template>
|
|
26
42
|
<NuxtLayout :name="layout">
|
|
27
|
-
<OnyxError v-if="error" :error />
|
|
43
|
+
<OnyxError v-if="error" :error="error" />
|
|
28
44
|
<ContentRenderer v-else-if="data" :value="data" />
|
|
29
45
|
</NuxtLayout>
|
|
30
46
|
</template>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sit-onyx/nuxt-docs",
|
|
3
|
-
"version": "0.8.1-dev-
|
|
3
|
+
"version": "0.8.1-dev-20261124091709",
|
|
4
4
|
"description": "Nuxt layer/template for creating documentations with the onyx design system",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/SchwarzIT/onyx/issues"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"main": "./nuxt.config.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@sit-onyx/mdc": "^0.3.2-dev-
|
|
24
|
+
"@sit-onyx/mdc": "^0.3.2-dev-20261124091709"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@fontsource-variable/source-code-pro": "^5.3.1",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"@nuxtjs/mdc": "~0.23.4",
|
|
33
33
|
"@playwright/experimental-ct-vue": "1.62.1",
|
|
34
34
|
"@playwright/test": "1.62.1",
|
|
35
|
-
"@sit-onyx/icons": "^1.14.0-dev-
|
|
36
|
-
"@sit-onyx/nuxt": "^1.2.1-dev-
|
|
35
|
+
"@sit-onyx/icons": "^1.14.0-dev-20261124091709",
|
|
36
|
+
"@sit-onyx/nuxt": "^1.2.1-dev-20261124091709",
|
|
37
37
|
"@sit-onyx/shared": "^0.1.0",
|
|
38
38
|
"nuxt": "4.6.4",
|
|
39
39
|
"sass-embedded": "1.108.2",
|
|
40
|
-
"sit-onyx": "^1.23.0-dev-
|
|
40
|
+
"sit-onyx": "^1.23.0-dev-20261124091709",
|
|
41
41
|
"typescript": "6.0.3",
|
|
42
|
-
"vue": "3.5.
|
|
42
|
+
"vue": "3.5.46"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@fontsource-variable/source-code-pro": ">= 5",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"@nuxtjs/color-mode": ">= 4",
|
|
49
49
|
"@nuxtjs/i18n": ">= 10",
|
|
50
50
|
"@nuxtjs/mdc": ">= 0.20.2",
|
|
51
|
-
"@sit-onyx/icons": "^1.14.0-dev-
|
|
52
|
-
"@sit-onyx/nuxt": "^1.2.1-dev-
|
|
51
|
+
"@sit-onyx/icons": "^1.14.0-dev-20261124091709",
|
|
52
|
+
"@sit-onyx/nuxt": "^1.2.1-dev-20261124091709",
|
|
53
53
|
"sass-embedded": ">= 1",
|
|
54
|
-
"sit-onyx": "^1.23.0-dev-
|
|
54
|
+
"sit-onyx": "^1.23.0-dev-20261124091709"
|
|
55
55
|
},
|
|
56
56
|
"engines": {
|
|
57
57
|
"node": ">=22"
|