Skip to content

Latest commit

 

History

History
66 lines (51 loc) · 1.92 KB

File metadata and controls

66 lines (51 loc) · 1.92 KB

robots.txt

검색 엔진 크롤러가 사이트에서 어떤 URL에 액세스할 수 있는지 알려주기 위해 app 디렉터리의 루트에 로봇 배제 표준과 일치하는 robots.txt 파일을 추가하거나 생성하세요.

app/robots.txt

User-Agent: *Allow: /Disallow: /private/Sitemap: https://acme.com/sitemap.xml

Robots 반환하는 robots.js 또는 robots.ts 파일을 추가하세요.

app/robots.ts

import { MetadataRoute } from 'next'

export default function robots(): MetadataRoute.Robots {
  return {
    rules: {
      userAgent: '*',
      allow: '/',
      disallow: '/private/',
    },
    sitemap: 'https://acme.com/sitemap.xml',
  }
}

출력 결과:

User-Agent: *Allow: /Disallow: /private/Sitemap: https://acme.com/sitemap.xml
type Robots = {
  rules:
    | {
        userAgent?: string | string[]
        allow?: string | string[]
        disallow?: string | string[]
        crawlDelay?: number
      }
    | Array<{
        userAgent: string | string[]
        allow?: string | string[]
        disallow?: string | string[]
        crawlDelay?: number
      }>
  sitemap?: string | string[]
  host?: string
}
버전 변경 사항
v13.3.0 robots introduced.