Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs-site/app/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<script setup lang="ts">

// Hardcode path to '/' so it is never affected by NUXT_APP_BASE_URL at runtime.
// The landing collection always contains exactly one document (content/index.md).
// Using .first() avoids any stored-path edge cases ('/index', '', etc.) that
// could cause .path('/').first() to return null and throw a 404.
const { data: page } = await useAsyncData('landing', () =>
queryCollection('landing').path('/').first(),
queryCollection('landing').first(),
)

if (!page.value) {
Expand Down
24 changes: 14 additions & 10 deletions docs-site/content.config.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
import { defineContentConfig, defineCollection } from '@nuxt/content'
import { useNuxt } from '@nuxt/kit'
import { joinURL } from 'ufo'
import { resolve } from 'path'

/**
* Local content configuration for uPKI-CA docs.
*
* We only declare the `landing` collection here (content/index.md).
* The `docs` collection (content/docs/**) is handled by the Docus layer.
*
* We use an explicit `cwd` (mirroring the Docus layer pattern) to ensure
* @nuxt/content resolves `index.md` from THIS project's content/ directory
* rather than leaving it ambiguous in the layer stack. Without it, since
* Docus PR #1274 no longer defines the landing collection when index.vue
* exists, the collection ends up empty and the landing page returns 404.
* After Docus PR #1274 (Feb 16 2026), the Docus layer no longer defines the
* `landing` collection when app/pages/index.vue exists in the user project.
* We must define it here with an explicit `cwd` so that @nuxt/content resolves
* index.md from THIS project's content/ directory.
*
* We use `resolve(process.cwd(), 'content')` rather than useNuxt() because
* this file is evaluated by c12/jiti in the same Node.js process as `nuxt build`,
* making process.cwd() a guaranteed, zero-import way to get the project root.
* Importing @nuxt/kit inside jiti can fail silently (c12 catches evaluation
* errors and falls back to defaultConfig: { collections: {} }), which would
* leave the landing collection empty and cause a 404 on the landing page.
*/
const { options } = useNuxt()
const cwd = joinURL(options.rootDir, 'content')
const contentDir = resolve(process.cwd(), 'content')

export default defineContentConfig({
collections: {
landing: defineCollection({
type: 'page',
source: {
cwd,
cwd: contentDir,
include: 'index.md',
},
}),
Expand Down
Loading