JSPM

  • Created
  • Published
  • Downloads 5269
  • Score
    100M100P100Q15537F
  • License MIT

Package Exports

  • nuxt-simple-robots

Readme

nuxt-simple-robots

NPM version NPM Downloads GitHub stars

Simply manage the robots crawling your Nuxt v3 app.


Status: Early Access
Please report any issues 🐛
Made possible by my Sponsor Program 💖
Follow me @harlan_zw 🐦 • Join Discord for help

Features

  • 🤖 Creates best practice robot data
  • 🗿 Adds X-Robots-Tag header, robot meta tag and robots.txt
  • 🔄 Configure using route rules

Install

npm install --save-dev nuxt-simple-robots

# Using yarn
yarn add --dev nuxt-simple-robots

Setup

nuxt.config.ts

export default defineNuxtConfig({
  modules: [
    'nuxt-simple-robots',
  ],
})

Configure route indexing

Using route rules, you can configure how your routes are indexed by search engines.

export default defineNuxtConfig({
  // Recommended 
  runtimeConfig: {
    siteUrl: 'https://example.com',
  },
  // OR 
  sitemap: {
    host: 'https://example.com',
  },
})

Module Config

robotsEnabledValue: string robotsDisabledValue: string

indexable

  • Type: boolean
  • Default: runtimeConfig.public.indexable
  • Required: nuxt.options.runtimeConfig.indexable || process.env.NODE_ENV === 'production'

Whether the site is indexable by search engines.

disallow

  • Type: string[]
  • Default: ['/_nuxt/*']
  • Required: false

Disallow paths from being crawled.

sitemap

  • Type: string | string[] | false
  • Default: false

The sitemap URL(s) for the site. If you have multiple sitemaps, you can provide an array of URLs. Note that they must be absolute URLs.

robotsEnabledValue

  • Type: string
  • Default: 'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1'
  • Required: false

The value to use when the site is indexable.

robotsDisabledValue

  • Type: string
  • Default: 'noindex, nofollow'
  • Required: false

The value to use when the site is not indexable.

Sponsors

License

MIT License © 2022-PRESENT Harlan Wilton