dynamic site generation
Answered
White-tailed Tropicbird posted this in #help-forum
White-tailed TropicbirdOP
I couldn't find any documentation on it, but my problem is that I made a portfolio in next.js and I have a route which fetches my github repositories, it has a fetch with the token and everything, basically stuff that shouldn't be revealed to the client, my problem is that on build it only builds a static site, which won't update when I add/modify a repository in my github.
It will make a request, and save the response as a file for it to be fetched.
It will make a request, and save the response as a file for it to be fetched.
Answered by Ray
or make that route to be dynamic if you are hosting the site in a node environment
22 Replies
@White-tailed Tropicbird I couldn't find any documentation on it, but my problem is that I made a portfolio in next.js and I have a route which fetches my github repositories, it has a fetch with the token and everything, basically stuff that shouldn't be revealed to the client, my problem is that on build it only builds a static site, which won't update when I add/modify a repository in my github.
It will make a request, and save the response as a file for it to be fetched.
you will need to rebuild the site after you add/modify if you are doing static export
or make that route to be dynamic if you are hosting the site in a node environment
Answer
White-tailed TropicbirdOP
yeah, I couldn't find how to make a dynamic route, the documentation says to add the revalidate export, but this still builds a static site
@White-tailed Tropicbird yeah, I couldn't find how to make a dynamic route, the documentation says to add the revalidate export, but this still builds a static site
yeah dynamic route doesn't work in static export
so you will need to rebuild the site every time you add/modify the data
White-tailed TropicbirdOP
so I need to completly build the site as dynamic? can I do that?
where do you host your app?
White-tailed TropicbirdOP
I for now in firebase, but since it doesn't seem to be able to host a dynamic site, I can move it to my server
I have a vps in hetzner
White-tailed TropicbirdOP
yeah but not in the free plan
I need functions
oh ok
White-tailed TropicbirdOP
and since I already have a vps, I can dockerize a node server and put it there
if you are hosting in a node env, just remove the output in the
and export
next.config.js and export
revalidate on that route@Ray if you are hosting in a node env, just remove the output in the `next.config.js`
and export `revalidate` on that route
White-tailed TropicbirdOP
oh right, I can add distDir for the dist directory
@Ray https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile
White-tailed TropicbirdOP
I will check that out, thanks
oh yeah, I was able to build a dynamic route now
thanks a lot
@White-tailed Tropicbird thanks a lot
you're welcome