N
Nuxt6mo ago
envizar

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 expected
12 Replies
Smef
Smef6mo ago
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?
envizar
envizarOP6mo ago
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 off
Smef
Smef6mo ago
Ohhhh... 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
Smef
Smef6mo ago
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
envizar
envizarOP6mo ago
Btw I want some pages to be accessible via url, but not from other pages
Smef
Smef6mo ago
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
Smef
Smef6mo ago
Nuxt
Prerendering · Get Started with Nuxt
Nuxt allows pages to be statically rendered at build time to improve certain performance or SEO metrics
envizar
envizarOP6mo ago
Why it can't just recursively loop all files in content folder
Smef
Smef6mo ago
The content folder isn't a URL for it to pre-render
envizar
envizarOP6mo ago
Btw thanks for explaining why it works like this maybe I can just place somewhere all links to all pages with display none 🤔
Smef
Smef6mo ago
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
Want results from more Discord servers?
Add your server