/* eslint-disable */ 'use client'; /* https://strapi.io/blog/how-to-create-an-ssg-static-site-generation-application-with-strapi-webhooks-and-nextjs */ import type { InferGetStaticPropsType } from 'next'; import Head from "next/head"; import Image from "next/image"; import Link from "next/link"; import "@/globals.css"; type BlogPostAttributes = { imageUrl: string; title: string; description: string; }; type BlogPost = { id: string; attributes: BlogPostAttributes; }; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export const getStaticProps = async () => { try { const resulting = await fetch("https://cms.quivr.app/api/blogs"); // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const data: { data: BlogPost[] } = await resulting.json(); return { props: { result: data.data, }, }; } catch (error) { console.error("Error fetching blogs:", error); return { notFound: true, // this will return a 404 page }; } }; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types const Blog = ({ result }: InferGetStaticPropsType) => { return (
Quivr - Blog

Blog Posts

{result.map((post, index) => { if (index === 0) { // Special layout for the first post return (

{post.attributes.title}

{post.attributes.description}

blog-post
); } else { // Standard layout for the rest of the posts return (
blog-post

{post.attributes.title}

{post.attributes.description}

); } })}
); } export default Blog;