nuxt: Generate static site with local CMS not working after deploy
So I’m trying to use Nuxt with a local install of Craft CMS to generate a static site (and eventually a headless CMS). It works just fine locally… because it has access to the local API endpoints on my machine. nuxt generate works too, as it can reach the API, however, when I deploy the static output from the /dist folder, my links between pages fail because it’s still trying to hit my local API. I though that the nuxt generate would inject the necessary data for that page, and I could still use the nice “SPA” style page transitions, but with all static content (maybe I’m wrong here?).
Any thoughts would be helpful, thanks!
<div align="right">This question is available on Nuxt.js community (#c912)</div>About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 30 (11 by maintainers)
I talked with @pi0 and himself has the same need, we might create a module to save the API results into
dist/whennuxt generateand use these results on navigating on client-side 🚀@samburgers we plan to add a support for full static generation, the mode will be “universal” but we will add an option like "generate.static: true` to avoid calling any API on the client-side.
This is a big feature for me @DreaMinder FWIW – because my use case is Vue on the frontend communicating to a “headless” CMS on the backend… so I’d really like to be able to have, say, the “blog index” page statically rendered with the latest 5 blogs that were pulled in via API from the CMS.
Hi @stursby
I created an example with this logic, check out https://nuxt-static.surge.sh
I made a PR on your repo, I let you check it: https://github.com/stursby/nuxt-static/pull/1
One thing, this is possible only with
rc5of nuxt (introducingprocess.static) (coming soon).rc5 is out 😃
@stursby It is already planned for after 1.0 release, Stay tuned 😃