pre-render posts
Unanswered
Transvaal lion posted this in #help-forum
Transvaal lionOP
Hi,
I use Vercel Postgres.
I'm trying to build a blog from scratch.
Below the code snippets for the home page that fetch the posts.
The code works, I can see a loading message just before seeing my posts.
I would like to fetch posts at the build time for SEO.
How can I achieve this?
Merci!
I use Vercel Postgres.
I'm trying to build a blog from scratch.
Below the code snippets for the home page that fetch the posts.
import { getPosts } from "../lib/action.js";
export default async function Home() {
const posts = await getPosts();
return (
<>
<h1>Find Your Answer Quickly!</h1>
{posts.length > 0 ? (posts.map(post => (
...
}
</>
);
}The code works, I can see a loading message just before seeing my posts.
I would like to fetch posts at the build time for SEO.
How can I achieve this?
Merci!