nuxt content: document not found
Any .md file I haven't referenced in index.md returns
Document not found
Btw when I use pnpm dev -o
, everything works as expected12 Replies
Can you explain the problem a bit more?
pnpm run dev
is how you would run your dev server, which would make it available to display the content
Are you having a problem in production but not dev?It only happens when I use
nuxi generate
and npx serve .output/public
On dev server everything is ok
I think it's a kind of annoying optimization, not referenced md files just ignored when building for production
But idk how to turn this offOhhhh... this isn't an optimization. This is how SSG works
You don't have a server, so you can't serve different files based on queries or URL parameters
Everything gets evaluated once, when you run generate
If it doesn't have a page and isn't used, the content essentially isn't part of your site
Each page must have its own URL, and the crawler needs to be able to find those pages through links on your site to be able to detect it
If the crawler isn't detecting those other pages and the links, you COULD manually specify them to be crawled, but it probably means it's a discoverability problem on your site, and your users won't be able to make it to those links either
Btw I want some pages to be accessible via url, but not from other pages
If the ONLY way you EVER want people to be able to reach your content is through entering the URL in their browser (or maybe a link on some other site), then you would probably need to manually enter those routes to be crawled
Nuxt
Prerendering · Get Started with Nuxt
Nuxt allows pages to be statically rendered at build time to improve certain performance or SEO metrics
Why it can't just recursively loop all files in content folder
The content folder isn't a URL for it to pre-render
Btw thanks for explaining why it works like this
maybe I can just place somewhere all links to all pages with display none 🤔
You can specify the prerender routes in the config. Check out that link I posted
You'll need to make sure all those links actually work, of course, but if they're in there it'll see the content