harlan-zw / nuxt-seo

The complete SEO solution for Nuxt.
https://nuxtseo.com
MIT License
1.07k stars 70 forks source link

Problem with prerendering #45

Closed lukaszflorczak closed 10 months ago

lukaszflorczak commented 1 year ago

Details

Hi there!

I have encountered a problem where after using nuxt-seo-kit and building the application, Nuxt is using prerendered data. I have a website that has multiple landing pages, which fetch some content from CMS. The intention is for this data to be fetched dynamically. However, Nuxt with nuxt-seo-kit always uses prerendering regardless of the settings in routeRules. Disabling swr and forcing ssr did not help, as I always received data from the build time on the server-side.

I'm not sure if it's possible, but since the sitemap and broken-link-checker require prerendering to work, it should only be activated if these modules are active (I see in the code, it's enabled in the config regardless of the use of sitemap and broken-link-checker), and then the data should be cleared in some way.

Finally I used this config:

  nitro: {
    prerender: {
      crawlLinks: false,
      routes: [],
      ignore: ['/'],
    },
  },

but it's more of a workaround than a solution to the problem.

harlan-zw commented 1 year ago

Hey @lukaszflorczak, thanks for the issue!

As you discovered pre-rendering is currently enabled by default for v1. This will be reverted in v2 which I hope to complete in the next few weeks.

lukaszflorczak commented 1 year ago

Thanks for the info. I will waiting for the next version.

sandros94 commented 1 year ago

It took me quite a while to understand why swr wasn't working, since it is incompatible with prerendering.

Could we add this note in the related FAQs, till v2 is out?

EDIT: What are the modules that needs prerendering other than simple-sitemap?