alpixel/seobundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

  1. Install the package
composer require 'alpixel/seobundle'
  1. Update AppKernel.php
new Alpixel\Bundle\SEOBundle\SEOBundle(),
  1. 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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-01-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固