I use NextJS and I'm trying to make a static site with Wordpress as a backend, I managed to deploy my site with GitLab which deploys to an FTP server.
My problem is that I have to rebuild each time to change the data
I don't want to use useEffect because it's not great for SEO, and I can't use getStaticProps with a NextJS 14 app
async function fetchData() {
const res = await fetch("fetchUrl", {
next: { revalidate: 60 }, // Revalidation ISR (par exemple, toutes les 60 secondes)
});
if (!res.ok) throw new Error("Failed to fetch posts");
return res.json();
}
export default async function Home() {
const data = await fetchData();
return (
<>
<div className="bg-red-500">data wordpress and deploy ci/cd</div>
<pre>{data.acf.titre}</pre>
</>
);
}
I would like my page to fetch by refreshing the deployed site in the correct way without affecting SEO or performance.