@ulu/vite-plugin-no-index
v0.0.1
Published
Simple plugin that adds _headers, robots.txt to outDir to prevent indexing. Can be enabled/disabled.
Maintainers
Readme
@ulu/vite-plugin-no-index
A simple Vite plugin that adds _headers and robots.txt to the build output directory (outDir) to prevent search engines from indexing the site.
Installation
npm install -D @ulu/vite-plugin-no-indexUsage
In your vite.config.js:
import { defineConfig } from "vite";
import noIndex from "@ulu/vite-plugin-no-index";
export default defineConfig({
plugins: [
noIndex({ enabled: true })
]
});Options
| Option | Type | Default | Description |
|---------|-----------|---------|---------------------------------------------------------------------------|
| enabled | boolean | false | When true, the plugin generates the _headers and robots.txt files. |
Output
When enabled: true, the plugin will create the following files in your Vite outDir upon building:
_headers
/*
X-Robots-Tag: noindexrobots.txt
User-agent: *
Disallow: /