- How do I quickly set up SEO for a Laravel blog using this package?
- Install via Composer, publish migrations/config, then attach the `HasSEO` trait to your `Post` model. Update SEO data via `$post->seo->update(['title' => '...', 'description' => '...'])` and render tags in Blade with `{!! seo()->for($post) !!}`. No manual tag generation needed.
- Does this package work with Laravel 10+ and Inertia.js?
- Yes, it’s fully compatible with Laravel 10/11 and automatically adds the `inertia` attribute to `<title>` tags for SPAs. No extra configuration is required for Inertia.js integration.
- Can I generate SEO tags dynamically without storing them in the database?
- Absolutely. Use the `getDynamicSEOData()` method in your model to compute SEO fields on-the-fly (e.g., pull `title` from the model’s `name` field). The package merges dynamic data with static SEO records automatically.
- What structured data schemas does this package support out of the box?
- It includes built-in JSON-LD schemas for **Article**, **Breadcrumbs**, and **FAQPage**. You can also extend it for custom schemas like **Product** or **HowTo** by creating a `SEODataTransformer` for your model.
- How do I handle multi-language SEO (hreflang tags) with this package?
- The package doesn’t include built-in hreflang support, but you can manually add `AlternateTag` entries via the config or middleware. For multi-language sites, pair it with `spatie/laravel-translatable` or manage hreflang tags in your SEO model’s `alternate_links` field.
- Will this package slow down my high-traffic Laravel app?
- The package is lightweight, but dynamic SEO data (`getDynamicSEOData()`) can impact performance if called on every request. Cache the results in your model or use Laravel’s cache facade for heavy computations.
- Can I use this for API responses or headless Laravel apps?
- While designed for Blade templates, you can manually pass SEO data to API responses by instantiating a `SEOData` object. However, it lacks built-in support for non-Eloquent data sources like GraphQL or API-driven responses.
- How do I customize the default title suffix (e.g., add my site name)?
- Set the `title_suffix` in the published config file (`config/seo.php`). For example, `'title_suffix' => ' | My Awesome Site'` will append your site name to every title. Override it per-model via `getDynamicSEOData()` if needed.
- Does this package handle favicons and robots.txt automatically?
- Yes. Favicons are rendered via the `favicon` config path, and robots tags (e.g., `noindex`) are controlled by the `robots` field in your SEO model. Configure defaults in `seo.php` and override them per-page as needed.
- What’s the best way to test SEO tags in my Laravel app?
- Use Laravel’s HTTP tests to assert rendered tags: `assertStringContainsString('<title>Your Title</title>', $response->getContent())`. For structured data, validate JSON-LD output with Google’s [Rich Results Test](https://search.google.com/test/rich-results). Test dynamic SEO by mocking `getDynamicSEOData()` in unit tests.