Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Robots Middleware Laravel Package

spatie/laravel-robots-middleware

Laravel middleware to control search engine indexing via X-Robots-Tag/robots meta behavior. Extend the base middleware and implement shouldIndex() to allow or block indexing per request (e.g., disable for admin routes), without changing your views.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • SEO & Crawlability Control: Enables granular control over search engine indexing (e.g., blocking sensitive routes like /admin, /checkout, or /api from appearing in search results).
  • Dynamic Indexing Policies: Supports use cases where indexing rules vary by route, user role, or environment (e.g., staging vs. production).
  • Compliance & Privacy: Quickly block indexing for GDPR-sensitive pages (e.g., user profiles, PII forms) without manual meta tag edits.
  • Performance Optimization: Reduces unnecessary crawl budget waste by search engines on non-critical paths (e.g., internal dashboards, webhooks).
  • Roadmap Efficiency: Avoids reinventing middleware for robots.txt/headers, accelerating feature delivery for SEO-sensitive projects.
  • Build vs. Buy: Prefer this over custom middleware if the use case aligns with its simplicity (no need for complex logic like user-agent targeting).

When to Consider This Package

  • Adopt if:

    • Your Laravel app has static or dynamic routes requiring uniform noindex/index rules.
    • You need a lightweight, maintainable solution for SEO compliance (e.g., blocking admin routes).
    • Your team lacks expertise in crafting middleware or prefers battle-tested open-source solutions.
    • You’re using Laravel and want to avoid manual meta tag management per view.
  • Look elsewhere if:

    • You need fine-grained user-agent targeting (e.g., blocking only Googlebot while allowing Bing).
    • Your indexing rules require runtime logic (e.g., user-specific permissions) beyond middleware conditions.
    • You’re using a non-Laravel framework or need server-level robots.txt management (consider spatie/laravel-robots-txt instead).
    • Your app has highly dynamic content where indexing decisions depend on complex business logic (custom middleware may be better).

How to Pitch It (Stakeholders)

For Executives: "This package lets us centrally control which parts of our site are search-engine-indexable with a single middleware toggle—no manual tagging per page. For example, we can instantly block admin panels or GDPR-sensitive routes from appearing in search results, improving compliance and performance. It’s a 10-minute setup that saves dev time and reduces crawl budget waste by search engines. Given its MIT license and Spatie’s track record, it’s a low-risk, high-reward choice for SEO-sensitive features."

For Engineering: *"Spatie’s laravel-robots-middleware provides a dead-simple way to add X-Robots-Tag: noindex or index headers via middleware. Key benefits:

  • Zero boilerplate: Just register the middleware in app/Http/Kernel.php and define rules in config/robots.php.
  • Flexible: Supports route-based, environment-based, or even dynamic conditions (e.g., if (auth()->check())).
  • Lightweight: No dependencies, MIT licensed, and actively maintained (last update: Feb 2026).
  • SEO best practice: Aligns with Google’s recommendations for crawlability control.

Use case example: Block /admin/* routes globally with:

Robots::forPaths(['admin/*'])->deny();

Perfect for projects where SEO compliance is critical but we don’t want to clutter views with meta tags."*

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport