harlan-zw / nuxt-seo

The complete SEO solution for Nuxt.

Home Page:https://nuxtseo.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

robots.txt - make i18n optional for specific routes

ronenteva opened this issue · comments

Clear and concise description of the problem

While automatic i18n integration is great, it's not needed for some routes.
For example, there's no need to block /fr/cdn-cgi/

Suggested solution

add i18n config that is enabled by default.

export default defineNuxtConfig({
  robots: {
    disallow: ['/secret', '/admin'],
    i18n: false
  }
})

Alternative

No response

Additional context

No response

In Nuxt Simple Robots 4.0.0-rc.15 you have two options:

  1. Opt-out of all i18n locale splitting:
export defineNuxtConfig({
  robots: {
    autoI18n: false,
  }
})
  1. Opt-out of i18n locale splitting for a group:
export defineNuxtConfig({
 robots: {
    groups: [
      {
        disallow: [
          '/docs/en/v*',
          '/docs/zh/v*',
          '/forum/admin/',
          '/forum/auth/',
        ],
        _skipI18n: true,
      },
    ],
  },
})

Let me know if you have any issues.

@harlan-zw Thanks!
I see that you've automatically excluded /cdn-cgi which is great, I suggest also excluding /api