megaads/generate-sitemap
Composer 安装命令:
composer require megaads/generate-sitemap
包简介
This package genernate sitemap.xml file automatically base on databse tables.
README 文档
README
This package generate sitemap.xml file automatically base on database table and route
Install and Configuration
Using composer command
composer require megaads/sitemap-generator
After composer install package complete, open file app.php and add below line to providers:
Megaads\Generatesitemap\GeneratesitemapServiceProvider::class
Then run this command to publish package config to application config folder (NOTE: Add option --force for overwrite config file. Be sure backup your config file before run with --force option):
php artisan vendor:publish --provider="Megaads\Generatesitemap\GeneratesitemapServiceProvider"
After run publish command open file generate-sitemap.php. IF NOT, CAN USING COMMAND TO COPY
cp vendor/megaads/generate-sitemap/config/generate-sitemap.php config/generate-sitemap.php
It see like this:
return [
'multiplesitemap' => false,
'defaultlocale' => '',
'sitemaptype' => [
'categories' => 'category',
'stores' => 'store',
'blogs' => 'blog'
],
'locales' => [
'us' => 'United States',
'uk' => 'United Kingdom',
'ca' => 'Canada',
'fr' => 'France',
'vn' => 'Vietnam',
],
'routes' => [ // Add route name from routes.php for generate sitemap url automatically
'store' => 'frontend::store::listByStore', // Show all stores
'category' => 'frontend::category::listByCategory', // Show all categories
'blog' => 'frontend::blog::detail', // Detail a blog
'coupon' => 'frontend::coupon::detail', // Detail a coupon
'store_n_keyword' => '/'
]
];
Default param multiplesitemap will be set to false, mean has single sitemap.xml was generator. If set it to true
sitemap file will be generated to folder with name as key at locales param config. Create folder name sitemap in folder public and
set chmod 775 for this folder for create multiple locales folder.
Add this line to bottom of app\config\app:
'domain' => 'http://example.com'
Finally, go the below url to generate sitemap. File sitemap.xml will be generate automatically and save to public path.
multiplesitemap is false:
If separate sitemap to multiple file using param is_multiple=true on url when call it. (attension: config sitemaptype on file config).
//example.com/sitemap-generator
//example.com/sitemap-generator?is_multiple=true
Or multiplesitemap is true. This option allow to generate sitemap with multiple language.
//example.com/generator-all-sitemap
Or call to url below for generate all sitemap type (blogs, categories...) group by locales:
//example.com/sitemap/generator-by-locale
And can see result file with url //example.com/sitemap.xml
megaads/generate-sitemap 适用场景与选型建议
megaads/generate-sitemap 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 900 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 08 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 megaads/generate-sitemap 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 megaads/generate-sitemap 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 900
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-30