Created
October 14, 2021 14:58
-
-
Save Macxim/48e73232dbc9fed58bd5b24e0b00d4df to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import Head from "next/head"; | |
import Image from 'next/image'; | |
import Prismic from '@prismicio/client'; | |
import { Client } from "../../prismic-configuration"; | |
import { PostList } from "../../components/blog/home"; | |
const Home = ({ blogHome, posts }) => { | |
return ( | |
<div className="flex flex-col min-h-screen font-sans"> | |
<h1 className="sr-only">{blogHome.data.headline}</h1> | |
<p className="text-lg text-gray-100">{blogHome.data.description}</p> | |
<PostList posts={posts} /> | |
</div> | |
) | |
}; | |
export async function getStaticProps() { | |
const blogHome = await Client().getSingle("blog_home") || {} | |
const posts = await Client().query(Prismic.Predicates.at("document.type", "post"), { orderings: "[my.post.date desc]"}) | |
return { | |
props: { | |
blogHome, | |
posts: posts ? posts.results : [], | |
} | |
} | |
} | |
export default Home; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment