harlan-zw / nuxt-seo

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

No robots.txt generated while nitro preset is 'cloudflare-pages' #358

Closed Whyjsee closed 5 days ago

Whyjsee commented 6 days ago

Describe the bug

When I set nitro.preset to cloudflare-pages in nuxt.config.ts and run pnpm run build, the output does not include robots.txt. Only when nitro.preset is set to static does the robots.txt get generated. Does anyone know how to solve this issue?

Here's my nuxt.config.ts

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  devtools: { enabled: true },
  srcDir: 'src/',
  nitro: {
    // preset: 'static',
    preset: 'cloudflare-pages',
    output: {
      dir: 'dist'
    },
  },
  modules: ['@nuxtjs/robots'],
  robots: {
    enabled: true,
    allow: ['/aaa'],
    disallow: [ '/user', '/login' ]
  },
  future: {
    compatibilityVersion: 3
  },
  compatibilityDate: '2024-09-19'
})

Reproduction

No response

System / Nuxt Info

Nuxt project info: (copied to clipboard)                                                                                                                                                            5:04:44 PM

------------------------------
- Operating System: Darwin
- Node Version:     v20.6.1
- Nuxt Version:     3.14.1592
- CLI Version:      3.15.0
- Nitro Version:    2.10.4
- Package Manager:  pnpm@9.0.4
- Builder:          -
- User Config:      default
- Runtime Modules:  @nuxtjs/i18n@9.1.0, @nuxtjs/robots@4.1.11, @nuxtjs/sitemap@6.1.5
- Build Modules:    -
------------------------------

                                                                                                                                                                                                    5:04:44 PM
👉 Report an issue: https://github.com/nuxt/nuxt/issues/new?template=bug-report.yml
👉 Suggest an improvement: https://github.com/nuxt/nuxt/discussions/new
👉 Read documentation: https://nuxt.com