alpixel/seobundle
Composer 安装命令:
composer require alpixel/seobundle
包简介
SEO manager, sitemap generator
README 文档
README
The SEOBundle provides a Symfony Bundle capable of handling auto generated meta tags, specific tags by route and sitemaps.
Installation
- Install the package
composer require 'alpixel/seobundle'
- Update AppKernel.php
new Alpixel\Bundle\SEOBundle\SEOBundle(),
- Update DB Schema
php app/console doctrine:schema:update --force --dump-sql
Meta tags annotation
There are 2 options for defining meta tags in your application :
Static tags
Work in progress
Dynamic tags with placholders
If you have meta tags which need to be defined from entities value, you can use the @MetaTag annotation in your controller.
use Alpixel\Bundle\SEOBundle\Annotation\MetaTag; ... /** * @Route("/paupiette") * @MetaTag("paupiette", providerClass="My\Project\Entity\Paupiette", title="Paupiette page") */ public function displayAction() {
After you set up the annotation, you'll need to run the following command which will register your new annotation in database.
php app/console alpixel:seo:metatag:dump
Then you will have a new entry in the back office on the "SEO" panel. You should be able to configure the meta tags pattern for the given controller.
The impacted entity should provide placeholders. First, it should implements the Alpixel\Bundle\SEOBundle\Entity\MetaTagPlaceholderInterface Then you have to implement the getPlaceholders() method in your entity. This is an example :
use Alpixel\Bundle\SEOBundle\Entity\MetaTagPlaceholderInterface; class News implements MetaTagPlaceholderInterface { public function getPlaceholders() { return array( "[news:title]" => $this->title, "[news:resume]" => substr(strip_tags($this->content), 0, 150) ); } }
统计信息
- 总下载量: 4.84k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-01-20