File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,23 +36,12 @@ export default function HomePage({
3636}
3737
3838export async function getStaticProps ( ) {
39- try {
40- const posts = await getBlogspotPosts ( ) ;
41- const props = { blogPosts : posts . slice ( 0 , 8 ) } ;
39+ const posts = await getBlogspotPosts ( ) . catch ( ( ) => [ ] ) ;
40+ const props = { blogPosts : posts . slice ( 0 , 8 ) } ;
4241
43- // On Netlify we serve fully static to avoid ISR function crashes
44- if ( process . env . NETLIFY ) {
45- return { props } ;
46- }
47-
48- return { props, revalidate : 3600 } ;
49- } catch {
50- const props = { blogPosts : [ ] } ;
51-
52- if ( process . env . NETLIFY ) {
53- return { props } ;
54- }
55-
56- return { props, revalidate : 600 } ;
57- }
42+ const isDeployPreview = process . env . CONTEXT === "deploy-preview" ;
43+ if ( isDeployPreview ) {
44+ return { props } ;
45+ } // fully static for previews
46+ return { props, revalidate : 3600 } ; // ISR for prod
5847}
You can’t perform that action at this time.
0 commit comments