Nuxt Content

How to use the Nuxt Robots module with Nuxt Content.

Nuxt Robots integrates with Nuxt Content out of the box. Allowing you to configure if a page should be indexable or not right from your markdown files.

Setup

Simply use the robots: false frontmatter key to opt out of indexing a page.

content/foo.md
---
robots: false
---

This will require that your markdown files have an associated path. When using Document Driven Mode, all markdown files will automatically have a path set.

Otherwise, you will need to make sure your markdown files have a path key.

content/foo.md
---
path: /foo
robots: false
---

Requirements

The Nuxt Content integration does not currently work with the v3 of Nuxt Content. It also won't work when using deploying your site with Cloudflare.

It's recommended to manually disable to integration in these cases:

nuxt.config.ts
export default defineNuxtConfig({
  robots: {
    disableNuxtContentIntegration: true,
  }
})

How it works

This will add an entry to your robots.txt file that looks like this:

robots.txt
User-agent: *
Disallow: /foo

It will add the X-Robots-Tag header and <meta name="robots"> tag to the page with the value of robotsDisabledValue.

Did this page help you?