tahsingokalp/laravel-sitemap
最新稳定版本:V12.0.0
Composer 安装命令:
composer require tahsingokalp/laravel-sitemap
包简介
Sitemap generator for Laravel
README 文档
README
Laravel Sitemap
This is a Laravel 8, 9 and 10 only fork of Laravelium/laravel-sitemap. The original repository has been abandoned.
PHP ^8.0 is required.
Installation
If laravelium/sitemap is already part of the project:
composer remove laravelium/sitemap
Then run:
composer require tahsingokalp/laravel-sitemap
php artisan vendor:publish --provider="TahsinGokalp\Sitemap\SitemapServiceProvider"
Generate a simple sitemap
Route::get('mysitemap', function() { $sitemap = resolve("sitemap"); $sitemap->add(URL::to(), '2012-08-25T20:10:00+02:00', '1.0', 'daily'); $sitemap->add(URL::to('page'), '2012-08-26T12:30:00+02:00', '0.9', 'monthly'); $posts = DB::table('posts')->orderBy('created_at', 'desc')->get(); foreach ($posts as $post) { $sitemap->add($post->slug, $post->modified, $post->priority, $post->freq); } // generate (format, filename) // sitemap.xml is stored within the public folder $sitemap->store('xml', 'sitemap'); });
Examples
- How to generate dynamic sitemap (with optional caching)
- How to generate BIG sitemaps (with more than 1M items)
- How to generate sitemap to a file
- How to use multiple sitemaps with sitemap index
and more in the Wiki.
统计信息
- 总下载量: 255
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-03-22