Nuxt Content static hosting
Hi all, I'm using Nuxt Content for my portfolio/blog website, and recently decided to move to digital ocean. I have the preset set to static, but the query to get the blogs folder does not seem to be working. It works locally when I use
bun generate
, but hosted it does not. No errors in the console - how can I go about debugging this?
My blogs list is empty, and going directly to a blog post url does not work either.2 Replies
Hi @Centy. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To debug your Nuxt Content static hosting issue on Digital Ocean, you can follow these steps:
1. First, ensure you're using the correct command for static site generation. As per the Nuxt Content documentation on Static Hosting, you should use:
This command will create a
dist/
directory with your static site.
2. Check if the contents.sqlite
database file is being generated correctly. This file should be located in .data/content/contents.sqlite
after running the generate command. If it's not there, it could explain why your queries aren't working.
3. For static hosting, Nuxt Content uses WASM SQLite in the browser for client-side navigation and actions. Make sure your hosting configuration allows serving of .wasm
files.
4. To debug the database issues, you can use the SQLite VS Code extension as suggested in the Nuxt Content Tools documentation. This will allow you to inspect the contents of your database and ensure your blog posts are actually being included.
5. If the database seems empty or incorrect, try resetting it:
6. Make sure your nuxt.config.ts
file is correctly configured for static generation. You might need to add specific configuration for prerendering your dynamic routes.
7. Check if your queries are using the correct collection name. For example, if your blog posts are in a 'blog' collection, make sure you're querying that collection.
8. If possible, enable verbose logging during the generate process to see if there are any hidden errors or warnings.
If these steps don't resolve the issue, you might need to provide more details about your specific setup, including your nuxt.config.ts
file, the query you're using to fetch blog posts, and the structure of your content directory.
Remember, when deploying to static hosting, all your content queries should be resolved at build time. If you're relying on any runtime queries, they won't work in a fully static site.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1002686255382921297> Kapa.ai is still learning and improving, please let me know how I did by reacting below.