Treat Static Pages As SSG
Unanswered
Keyhole wasp posted this in #help-forum
Keyhole waspOP
Hey everyone, I have two questions for which I am looking for answers.
1 - How do I make page SSG if I have only static content and html? Do I have to use getStaticPaths or getStaticProps to return an empty object as I will not be fetching anything, or will NextJS by default make static pages SSG?
2 - Will Next JS fetch SSG components that are cached on CDN in the background if the links to them appear in the viewport as Next JS does for SSR components?
1 - How do I make page SSG if I have only static content and html? Do I have to use getStaticPaths or getStaticProps to return an empty object as I will not be fetching anything, or will NextJS by default make static pages SSG?
2 - Will Next JS fetch SSG components that are cached on CDN in the background if the links to them appear in the viewport as Next JS does for SSR components?
3 Replies
@Keyhole wasp Hey everyone, I have two questions for which I am looking for answers.
1 - How do I make page SSG if I have only static content and html? Do I have to use getStaticPaths or getStaticProps to return an empty object as I will not be fetching anything, or will NextJS by default make static pages SSG?
2 - Will Next JS fetch SSG components that are cached on CDN in the background if the links to them appear in the viewport as Next JS does for SSR components?
1. static pages = SSG. so yes, nextjs will make static pages SSG
2. yes, that's called prefetching
2. yes, that's called prefetching
Keyhole waspOP
So, I don't need to use getStaticProps and getStaticPaths explicitly if the page is static. Can you tell me how I can check if the page is serving from CDN or not?
that depends on the hosting provider, there isn't a universal answer