1

All the pages including dynamic routes in my site are statically generated, when you view source you correctly see all the markup as expected. But for some reason the homepage is in client only mode, ie when you view source there is no content in the markup, just the scripts and if you disable JS you get a blank page.

The app is in Netlify and I can see an error during the deploy Error generating route "/ ": This page could not be found. I'm not sure if the space after the slash is significant?

My nuxt-config has no special settings other than interval/concurrency

  target: "static",
  ...
  generate: {
    interval: 500,
    concurrency: 30,
    routes: [
      '/reports/secret-pages/',
      '/page/form-thanks/'
    ]
  }

These versions are installed in nuxt.config.js

"dependencies": {
    "@nuxtjs/apollo": "^4.0.1-rc.5",
    "nuxt": "^2.15.7",

I've tried moving the homepage to a different route eg /test/index.vue/ and SSG kicks in properly again, so there is no problem with the code in the page. Likewise I can change my homepage to a basic template like below and it still renders in client-only mode - it treats whatever I put in /index.vue as client-only.

<template>
    <div>
        <h1>Test</h1>
        <p>This is still in client only mode</p>
    </div>
</template>

How can i make sure my homepage statically generates?

codycustard
  • 448
  • 1
  • 4
  • 10

2 Answers2

0

I was struggling with that error for a week at least. It's all about the version of @nuxtjs/apollo. Try to downgrade it to

"@nuxtjs/apollo": "4.0.1-rc.1"

And all must work. Good luck!

  • I was so hopeful but alas this did not work with either `4.0.1-rc.1` or `4.0.0-rc19` ps its been longer than a week ( – codycustard Mar 17 '23 at 22:24
0

The issue was unrelated to Apollo. The offending code was on a different page in the site that had a fallback nuxt-link to ' '

<nuxt-link
  v-show="link" 
  :to="(page && page.url) 
    ? '/page/' + page.url + '/'
    : ' '" />

page in this context is an object returned via graphql so before it returns I'm linking to ' ' which is what causes Error generating route "/ "

so the fix was simply updating it to

<nuxt-link
  v-show="link" 
  :to="(page && page.url) 
    ? '/page/' + page.url + '/'
    : '/'" />
codycustard
  • 448
  • 1
  • 4
  • 10