thepixeldeveloper / sitemap-bundle
一个集成了thepixeldeveloper/sitemap的Symfony Bundle。
3.0.6
2018-06-25 12:41 UTC
Requires
- php: >=7.0
- symfony/console: ^3|^4
- symfony/framework-bundle: ^3|^4
- symfony/yaml: ^3|^4
- thepixeldeveloper/sitemap: ^5
Requires (Dev)
README
一个集成了thepixeldeveloper/sitemap的symfony bundle。
安装
-
作为composer依赖项要求
composer require "thepixeldeveloper/sitemap-bundle"
-
注册bundle
# app/AppKernel.php public function registerBundles() { $bundles = [ new Thepixeldeveloper\SitemapBundle\ThepixeldeveloperSitemapBundle(), ]; }
-
导入路由
# app/config/routing.yml thepixeldeveloper_sitemap_bundle: resource: "@ThepixeldeveloperSitemapBundle/Resources/config/routing.yml" prefix: /
-
定义XML文件将被转储的位置。
thepixeldeveloper_sitemap: directory: '%kernel.project_dir%/var/sitemaps'
使用方法
-
创建一个事件监听器,用于监听
theixeldeveloper_sitemap.populate
事件。向Urlset集合添加URL。 -
Sitemaps的生成方式如下
./bin/console thepixedeveloper:sitemap:dump
-
您的sitemap将在以下位置可用:https://domain.tld/sitemap.xml