zrashwani / arachnid-sitemap-bundle
此包已被弃用且不再维护。未建议替代包。
通过遍历网站内部链接生成sitemap.xml的Symfony2包
1.0.0
2014-09-26 15:07 UTC
Requires
- php: >=5.3.0
- codeguy/arachnid: 1.*
- symfony/framework-bundle: ~2.1
Requires (Dev)
- phpunit/phpunit: ~3.7
- symfony/console: ~2.5
- symfony/symfony: ~2.3
This package is not auto-updated.
Last update: 2022-02-01 12:39:48 UTC
README
Symfony2包,通过动态遍历内部网站URL帮助您生成sitemap.xml。
此包使用Arachnid Web Crawler来提取网站URL,并使用它们构建sitemap.xml文件。
如何安装
您可以通过composer安装此包。将以下内容添加到composer.json的"require"部分
"zrashwani/arachnid-sitemap-bundle": "1.*"
然后运行composer update
将包添加到您的kernel
要启用sitemap包,请将其添加到kernel的registerBundles()方法中
use Symfony\Foundation\Kernel;
class MyKernel extends Kernel {
// ...
public function registerBundles() {
return array(
// ...
new Zrashwani\ArachnidSitemapBundle\ZrashwaniArachnidSitemapBundle(),
// ...
);
}
}
运行sitemap生成命令
sitemap生成实现为symfony2命令,可以按以下方式调用
php app/console arachnid:sitemap:generate http://your-base-url.com/
可以使用可选参数对sitemap.xml的内容和爬虫行为进行简单定制
- 使用
--links_depth
来指定爬虫将操作的链接级别,默认:3 - 使用
--sitemap_path
来指定要写入的sitemap文件的完整路径,默认:/path-to-web-directory/sitemap.xml - 使用
--frequency
为所有链接指定默认值
确保您的sitemap_path
对您的web服务器可写,以便命令可以正确放置sitemap内容。
如何贡献
- 分支此存储库
- 为每个功能或改进创建一个新的分支
- 从每个功能分支发送pull请求
将新功能或改进分开到独立的分支中,并为每个分支发送pull请求非常重要。这使我能够单独审查和合并新功能或改进。
所有pull请求都必须遵循PSR-2标准。