robots.txt for Nuxt Applications
robots.txt template for Nuxt.js (Vue.js) applications. Handles both SSR and static generation modes.
robots.txt
User-agent: * Disallow: /_nuxt/ Disallow: /api/ Disallow: /404 Allow: /_nuxt/builds/ Allow: /_nuxt/entry.* Sitemap: https://example.com/sitemap.xml
Line-by-Line Explanation
User-agent: * — applies to all crawlers
Disallow: /_nuxt/ — blocks Nuxt build artifacts and chunks
Disallow: /api/ — blocks server API routes
Disallow: /404 — prevents the error page from being indexed
Allow: /_nuxt/builds/ and /_nuxt/entry.* — ensures essential assets are accessible for rendering
Sitemap — directs crawlers to the sitemap
Best Practices for Nuxt
- ✓ Use @nuxtjs/robots module for automatic robots.txt generation with environment support.
- ✓ Nuxt 3 with SSR generates full HTML, making pages inherently crawlable.
- ✓ Block /api/ routes that serve data endpoints, not HTML content.
- ✓ Use nuxt-simple-sitemap for automatic sitemap generation.
Build a custom robots.txt for your Nuxt site
Open robots.txt GeneratorFrequently Asked Questions
How do I add robots.txt in Nuxt 3?▾
Use the @nuxtjs/robots module (recommended), place a file in /public, or create a server route at server/routes/robots.txt.ts for dynamic generation.
Does Nuxt SSR need a restrictive robots.txt?▾
No. Nuxt SSR delivers full HTML to crawlers, so a minimal robots.txt is usually sufficient. Only block internal API routes and build artifacts.
Should I use static generation or SSR for SEO?▾
Both work well for SEO. Static generation (nuxt generate) is faster and more reliable for crawlers. SSR is better for frequently updated content or personalized pages.
Related Templates
Next.js Production-ready robots.txt template for Next.js applications. Handles API routes, internal pages, and build artifacts properly. Angular robots.txt template for Angular apps. Handles build output, source maps, and ensures proper SPA crawling. Astro robots.txt template for Astro framework sites. Minimal configuration needed thanks to static-first architecture.