wizclumsy/sitemap
Composer 安装命令:
composer require wizclumsy/sitemap
包简介
Sitemap generator for Laravel projects
README 文档
README
Simple sitemaps for Laravel projects
Installing
Use Composer to install:
composer require clumsy/sitemap
In the config/app.php file, add this to the providers key:
Wizclumsy\Sitemap\SitemapServiceProvider::class,
Usage
The package automatically creates a route to resolve http://example.com/sitemap.xml. If there are no URLs to insert on your sitemap.xml or an error occurs while parsing them, a 404 error will be thrown on that route.
In order to add URLs to your sitemap, add a sitemap.php file inside the routes folder of your Laravel app. Inside, return an array with the desired URLs. For example:
<?php return [ url('/') ];
This will yield the following entry in your sitemap.xml:
...
<url>
<loc>http://workbench.local</loc>
</url>
...
To add tags to the URLs, make the array associative, using the links key as your collection of URLs:
<?php return [ 'changefreq' => 'monthly', 'priority' => '0.8', 'lastmod' => '2016-08-04', 'links' => [ url('/'), ] ];
If you want different URLs to have different values for the supporting tags, use more than one array:
<?php return [ [ 'changefreq' => 'daily', 'priority' => '1.0', 'links' => [ App\Models\Resource::where('active', true)->get()->pluck('permalink'), ], ], [ 'changefreq' => 'monthly', 'priority' => '0.8', 'lastmod' => '2016-08-04', 'links' => [ url('/'), ], ], ];
Customizing
You can optionally edit the path of the sitemap.php file which will contain your URLs and attach middleware to the sitemap route by publishing the default config to your local app:
php artisan vendor:publish --provider="Wizclumsy\Sitemap\SitemapServiceProvider" --tag=config
Legacy
For Laravel 4.1 or 4.2 projects, use the 0.1 branch. The 0.3 branch introduced a new default location of the sitemap.php file to be more consistent with the file structure of Laravel 5.3.
Learn more
Visit sitemaps.org for more info on the protocol.
wizclumsy/sitemap 适用场景与选型建议
wizclumsy/sitemap 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 03 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 wizclumsy/sitemap 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wizclumsy/sitemap 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-03-24