- How do I install benbjurstrom/laravel-sitemap-lite?
- Install the package with Composer using composer require benbjurstrom/laravel-sitemap-lite. Laravel package discovery should register the service provider automatically. Publish any provided configuration file if you need to customize the package defaults.
- Does Laravel Sitemap Lite support Eloquent models?
- Yes, the package is designed so you can register Eloquent models and include their records in the generated sitemap. This avoids manually listing every URL when your content lives in the database. You choose which models are registered, so only the content you want is exposed.
- How do I generate sitemap.xml in Laravel with this package?
- You register the routes or Eloquent models that should appear in the sitemap, then expose the sitemap route so requests to sitemap.xml return XML. The package builds the search-engine-ready XML output for you. Caching is optional if you want to avoid regenerating it on every request.
- Can I cache the generated Laravel sitemap?
- Yes, optional caching is part of the package. Caching the generated XML reduces database queries and rendering work on repeated sitemap requests. You should clear or refresh the cache when your content changes so the sitemap stays accurate.
- Does Laravel Sitemap Lite support sitemap indexes for large sites?
- Yes, sitemap index support is intended for larger sites. You can split URLs across child sitemaps and have the main sitemap.xml reference them. This keeps individual sitemap files manageable for search engines.
- Which Laravel versions are supported by laravel-sitemap-lite?
- Check the package's composer.json on Packagist for the exact Laravel and PHP version constraints. Composer will enforce those requirements during installation. The package is built for modern Laravel applications, so verify compatibility before adding it to older projects.
- How do I exclude routes or models from the Laravel sitemap?
- You control the sitemap by choosing which routes or Eloquent models you register. Anything you do not register is not included in the generated XML. For model-based sitemaps, you can also constrain the query so only eligible records are passed to the package.
- How can I test the sitemap in a Laravel application?
- Use Laravel's HTTP testing helpers to request your sitemap route and assert the response. You can check the status code, XML content type, and that expected URLs appear in the output. For cached sitemaps, test both cache-miss and cache-hit behavior if caching is enabled.
- Is Laravel Sitemap Lite suitable for production use?
- Yes, it is intended for generating sitemaps in Laravel applications, including production sites. Enable caching to avoid regenerating the XML on every request. For sites with many URLs, use the sitemap index support to split content into multiple files.
- What are alternatives to Laravel Sitemap Lite?
- spatie/laravel-sitemap is a common alternative with a broader feature set. Laravel Sitemap Lite focuses on minimal setup for routes and Eloquent models, plus optional caching and sitemap indexes. Choose based on how much customization and automation your project needs.