Step 6: Add Your First Plugin

This step uses @shevky/plugin-robots-txt because it is simple and easy to verify.

Prerequisites

  • A working Shevky project with src/site.json

Commands

Install the plugin (if not already installed):

npm install @shevky/plugin-robots-txt

Ensure it is listed in src/site.json:

"plugins": [
  "@shevky/plugin-robots-txt"
]

Add robots configuration:

"robots": {
  "allow": ["/"],
  "disallow": ["/draft/"]
}

Build and verify:

npm run build
cat dist/robots.txt

Expected Output

dist/robots.txt should contain:

User-agent: *
Allow: /
Disallow: /draft/

Sitemap: https://yourdomain.com/sitemap.xml

What Just Happened

  1. The plugin was discovered via the plugins array in site.json.
  2. PluginRegistry.load() dynamically imported the plugin package.
  3. During the dist:clean hook, the plugin read config.identity.url and config.robots values.
  4. It generated a robots.txt file and wrote it to dist/.

Common Errors

ErrorFix
Plugin not runningVerify the exact package name @shevky/plugin-robots-txt in plugins[]
Wrong sitemap URLSet identity.url correctly and rebuild
dist/robots.txt missingCheck build logs for plugin load errors

Related