Questions tagged [ssg]

68 questions
40
votes
6 answers

Error: getStaticPaths is required for dynamic SSG pages and is missing for "xxx". NextJS

I am getting this error "Error: getStaticPaths is required for dynamic SSG pages and is missing for 'xxx'" when I try to create my page in NextJS. I don't want to generate any static page on build time. So why do I need to create a 'getStaticPaths'…
Juanma Menendez
  • 17,253
  • 7
  • 59
  • 56
14
votes
3 answers

NextJS, _app, SSG, getInitialProps vs getStaticProps and how am I supposed to stick to DRY?

I know that the topic isn't new and I found (and read) a few discussions. What I couldn't find is an answer to my still remaining question. How do others work around the problem of not being able to use getStaticProps in _app.js ? getInitialProps is…
SMEETT
  • 166
  • 1
  • 9
10
votes
5 answers

How to get URL query string on Next.js static site generation?

I want to get query string from URL on Next.js static site generation. I found a solution on SSR but I need one for SSG. Thanks
Raju Ahammad
  • 873
  • 2
  • 9
  • 15
9
votes
2 answers

Can getStaticProps be used in a blog to update when a new post is posted?

So I'm a little bit confused about getStaticProps. getStaticProps runs at build time to generate static pages. My question is that if I have a blog that updates when a new post is posted I shouldn't use getStaticProps, right? Because it is called…
Harry zingh
  • 133
  • 1
  • 8
8
votes
1 answer

How to generate index.html with getStaticPaths in Next.js?

I am trying to generate an index.html page with getStaticPaths in Next.JS but every time I try to do so it throws out an error or creates an index directory instead of a file. So far I have tried passing: '', '/' and 'index' in params.page. I also…
Valchy
  • 165
  • 3
  • 14
5
votes
2 answers

Nuxt static not loading fetched state when pushing new route

I'm generating full static web app using nuxt as described here https://nuxtjs.org/blog/going-full-static/#crazy-fast-static-applications I have a small blog to load as static site also, so I'm using the fetch hook to load the data from api. async…
mysticalnetcore
  • 181
  • 1
  • 11
4
votes
1 answer

How to produce SSG from a vue project without nuxt

I created a vue project using the vue cli: vue create myproject I figured that the output when I do npm run build will be a single page application (SPA). What do I need to produce a static website (SSG / Jamstack) with my existing code? I know I…
allister
  • 71
  • 6
4
votes
0 answers

Next.js dynamic routes: avoid generating new pages for path params

tl;dr: I need mypage.com/users/123 to behave like mypage.com/users?user_id=123 I'm using Next.js 10. I'd like to have routes like mypage.com/users/123 and mypage.com/users/445. All my searches take me to dynamic routing, which suggests using this…
LGenzelis
  • 764
  • 6
  • 14
4
votes
1 answer

Next js error in console _next/data/QPTTgJmZl2jVsyHQ_IfQH/blog/post/21/.json

I receive an error in the console in my Next.js site. GET https://example.com/_next/data/QPTTgJmZl2jVsyHQ_IfQH/blog/post/21/.json net::ERR_ABORTED 404 I don't understand why it's happened. Maybe I'm using the router incorrectly? my link code: …
Bob
  • 129
  • 2
  • 9
3
votes
2 answers

Can part of a website be static site generated and the other be a traditional spa?

So, I've built a website in Nuxt and used ssg. It's great, but for another website 90% of it is all static text and images, but I want a customer login portal where they can see statuses of their products. With my understanding, I don't see how this…
3
votes
1 answer

Is there any static site generator that supports incremental builds?

I want to build a static site with a headless CMS back-end, where the build process will happen only a few pages at a time (whenever the user saves a page in the CMS), but I'm not finding any SSG that will build partial sites, rather than rebuilding…
Martin
  • 111
  • 1
  • 10
2
votes
1 answer

Next.js cumulative layout shift issue with SSG site

I have an CLS issue with this landing site. The landing site is statically generated in Next.js(SSG) as seen on this photo /. I must be missing something regarding Next.js SSG. When I open the generated index.html file, not all HTML content is…
Primoz Rome
  • 10,379
  • 17
  • 76
  • 108
2
votes
0 answers

What's wrong with my Next.JS app build time?

I've made simple static e-commerce app with Next.JS. For my product pages I fetch some strings of data (very little). When I build my app then receive ambiguous result output with yellow and red times in ms (pin a pic below). My code, for example…
andrewnosov
  • 374
  • 4
  • 14
2
votes
1 answer

How to choose between SSG and SSR?

I am currently exploring Nextjs and building a website with the same framework. The website has a public flow, protected routes (such as user dashboard, user project details, and general user data) , and product pages. The question is, how do i…
Soham Bhaumik
  • 211
  • 2
  • 15
2
votes
1 answer

Next js - Can't generate dynamic getStaticPaths with apollo client api

I wan't to generate a list of my posts' slugs for a SSG export in next.js, using Apollo graphql client. Here's my code: import { gql } from "@apollo/client"; import client from "../../graphql/apollo-client"; import { BLOG_POSTS, POST_DATA } from…
Shahriar
  • 1,855
  • 2
  • 21
  • 45
1
2 3 4 5