Index of every page on this site: llms.txt

Introduction

The getSiteRobotConfig() Nitro composable gives you access to the site-wide robots config, allowing you to determine if the site can or can't be indexed and why.

This can be useful for disabling certain SEO features when the environment does not allow for indexing.

API

function getSiteRobotConfig(e: RequestEvent): { indexable: boolean, hints: string[] }

Arguments

  • e: RequestEvent: The event object.

Returns

  • indexable: boolean: Whether the site is indexable.
  • hints: string[]: A list of hints as to why the site is or isn't indexable.

Example

server/routes/og.png.ts
import { defineEventHandler } from 'nuxt/server'
import { getSiteRobotConfig } from '#robots/server'

export default defineEventHandler((e) => {
  const { indexable } = getSiteRobotConfig(e)
  // avoid serving og images if the site is not indexable
  if (!indexable) {
    // ...
  }
})
Was this page helpful?