octave / sitemap-bundle
Symfony 网站地图生成器
2.0.3
2022-11-22 12:50 UTC
Requires
- php: >=7.0.1
- symfony/framework-bundle: ^2.8 || ^3.0 || ^4.0 || ^5.0
- symfony/templating: ^2.8 || ^3.0 || ^4.0 || ^5.0
- symfony/twig-bundle: ^2.8 || ^3.0 || ^4.0 || ^5.0
- twig/twig: ^1.28 || ^2.0 || ^3.0
README
安装
步骤 1: 使用 composer 下载 OctaveSitemapBundle
要求该扩展包
"require": { ... some repositories "octave/sitemap-bundle": "^1.0.0" }
然后运行 composer update
.
步骤 2: 启用扩展包
在内核中启用扩展包
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Octave\SitemapBundle\OctaveSitemapBundle(), // ... ); }
步骤 3: 实现您的网站地图源
<?php namespace AppBundle\Service; use Octave\SitemapBundle\Service\SourceInterface; use Octave\SitemapBundle\Model\Item; class AppSitemapSource implements SourceInterface { public function getItems() { return [ new Item('http://mysite.com/', new \DateTime(), Item::FREQ_ALWAYS, 1.0) ]; } }
步骤 4: 配置源服务
# app/config/services.yml services: app.sitemap.source: class: AppBundle\Service\AppSitemapSource tags: - { name: 'octave.sitemap.source' }