Add dynamic content to static Nuxtjs site

Viewed 25

I created a static site for my business using Nuxtjs with a counter that keeps a running total of how many trees have been planted. Is there a way to update this counter without rebuilding the site every few minutes? Ideally, I'd like it to get the new total every time the page is loaded. Since this is the only dynamic value on the site I thought a static site would be the best option but should it be moved to an SSR site?

1 Answers

If you do not care about SEO, you can stick with CSR (Client Side Rendering). Otherwise, use SSR (Server Side Rendering).

To update the counter, you can wrap it into a component and then update the component at periodic times (i.e every one-minute fetching data from rest API), without refreshing the whole page.

Related