From d252986e8f94d5de6a9546a1a8fff964bcc41356 Mon Sep 17 00:00:00 2001 From: Baptiste Leproux Date: Fri, 16 Oct 2026 17:41:08 +0200 Subject: [PATCH 1/3] chore(deps): try Nuxt Content v4 --- docs/nuxt.config.ts | 2 +- layer/app/components/docs/DocsAsideRight.vue | 2 +- layer/app/components/docs/DocsContentLink.vue | 19 + layer/app/pages/[[lang]]/[...slug].vue | 13 +- layer/app/templates/landing.vue | 2 + layer/app/utils/navigation.ts | 16 + layer/app/utils/toc.ts | 52 + layer/modules/content-v4.ts | 141 ++ layer/nuxt.config.ts | 4 + layer/nuxt.schema.ts | 2 +- layer/package.json | 1 + layer/server/agent-source.ts | 4 + layer/server/api/__sitemap__/urls.ts | 9 +- layer/server/middleware/content-snapshot.ts | 11 + layer/utils/preview.ts | 74 + patches/comark-content@0.4.1.patch | 99 ++ patches/nuxt-agent-discovery@0.7.0.patch | 13 + pnpm-lock.yaml | 1312 ++++------------- pnpm-workspace.yaml | 9 + 19 files changed, 722 insertions(+), 1063 deletions(-) create mode 100644 layer/app/components/docs/DocsContentLink.vue create mode 100644 layer/app/utils/toc.ts create mode 100644 layer/modules/content-v4.ts create mode 100644 layer/server/agent-source.ts create mode 100644 layer/server/middleware/content-snapshot.ts create mode 100644 layer/utils/preview.ts create mode 100644 patches/comark-content@0.4.1.patch create mode 100644 patches/nuxt-agent-discovery@0.7.0.patch diff --git a/docs/nuxt.config.ts b/docs/nuxt.config.ts index db2ab5f7e..4732ff8d1 100644 --- a/docs/nuxt.config.ts +++ b/docs/nuxt.config.ts @@ -1,6 +1,6 @@ export default defineNuxtConfig({ extends: ['docus'], - modules: ['@nuxtjs/i18n', 'nuxt-studio'], + modules: ['@nuxtjs/i18n'], site: { name: 'Docus', }, diff --git a/layer/app/components/docs/DocsAsideRight.vue b/layer/app/components/docs/DocsAsideRight.vue index 558a33a56..e4462521b 100644 --- a/layer/app/components/docs/DocsAsideRight.vue +++ b/layer/app/components/docs/DocsAsideRight.vue @@ -6,7 +6,7 @@ const props = defineProps<{ page?: DocsPage | null }>() -const links = computed(() => props.page?.body?.toc?.links || []) +const links = computed(() => getTocLinks(props.page?.body)) const { subNavigationMode } = useSubNavigation() const appConfig = useAppConfig() diff --git a/layer/app/components/docs/DocsContentLink.vue b/layer/app/components/docs/DocsContentLink.vue new file mode 100644 index 000000000..31d38a9db --- /dev/null +++ b/layer/app/components/docs/DocsContentLink.vue @@ -0,0 +1,19 @@ + + + diff --git a/layer/app/pages/[[lang]]/[...slug].vue b/layer/app/pages/[[lang]]/[...slug].vue index dfd7d1eb1..c0b2cce6f 100644 --- a/layer/app/pages/[[lang]]/[...slug].vue +++ b/layer/app/pages/[[lang]]/[...slug].vue @@ -2,6 +2,8 @@ import { kebabCase } from 'scule' import type { ContentNavigationItem, Collections } from '@nuxt/content' import { findPageHeadline } from '@nuxt/content/utils' +import { collectionDirs } from '#build/docus/content-v4.mjs' +import { DocsContentLink } from '#components' import { getLocaleKey } from '../../../utils/locale' import type { DocsPage } from '../../types' @@ -54,6 +56,14 @@ defineOgImage('Docs', { const github = computed(() => appConfig.github ? appConfig.github : null) +// Content v4: `stem` is relative to the collection folder, and `extension` keeps its dot. +const contentFile = computed(() => { + const dir = collectionDirs[collectionName.value] + const stem = page.value?.stem || '' + const extension = String(page.value?.extension || '').replace(/^\./, '') + return `${dir && !stem.startsWith(`${dir}/`) ? `${dir}/` : ''}${stem}.${extension}` +}) + const editLink = computed(() => { if (!github.value) { return @@ -65,7 +75,7 @@ const editLink = computed(() => { github.value.branch, github.value.rootDir, 'content', - `${page.value?.stem}.${page.value?.extension}`, + contentFile.value, ].filter(Boolean).join('/') }) @@ -99,6 +109,7 @@ const editLink = computed(() => { diff --git a/layer/app/templates/landing.vue b/layer/app/templates/landing.vue index 926e9b459..b13ce013c 100644 --- a/layer/app/templates/landing.vue +++ b/layer/app/templates/landing.vue @@ -1,5 +1,6 @@