gregory-coolich/yii2-seotools 问题修复 & 功能扩展

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

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

gregory-coolich/yii2-seotools

Composer 安装命令:

composer require gregory-coolich/yii2-seotools

包简介

Component and module to manage unique seo title, description, h1_heading and unique text associated with a page

README 文档

README

If you need set unique seo title, description associated with a page this is your extension, you can also add a html text using a wysiwis tool to add bold and links and improve your SEO in page with a unique content.

Set this fields using a module to manage all this functionality.

Use internally a md5 hash to made a unique id with (Host + Path) to identify pages and yii cache system and tag dependency to improve speed

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist gregory-coolich/yii2-seotools "*"

or add

"gregory-coolich/yii2-seotools": "*"

to the require section of your composer.json file.

###Migration

Run the following command in Terminal for database migration:

Linux/Unix:

yii migrate/up --migrationPath=@vendor/gregory-coolich/yii2-seotools/migrations

Windows:

yii.bat migrate/up --migrationPath=@vendor/gregory-coolich/yii2-seotools/migrations

###Config

A simple exmple of turning on seotool component.

'components' => [
        'seotools' => [
            'class' => 'gregory-coolich\seotools\Component',
        ],
    ],

Turning on the seotools Module:

Simple example:

    'modules' => [
        'seotools' => [
            'class' => 'gregory-coolich\seotools\Module',
            'roles' => ['@'], // For setting access levels to the seotools interface.
        ]
    ],

Usage

Once the extension is installed, simply use it in your code by :

 // @param bool $setCanonical true, try to create a canonical url and og url, action needs to have params
 // @param bool $checkDb try to get from DB params, true: try to get info from DB if it doesn't find save a new field
 // associated to current host + '/' + path, false: it just set the params give in the call. The db params has priority
 // over the call function params. It does a merge
$setCanonical = false;
$checkDb = true;
Yii::$app->seotools->setMeta(['title' => \Yii::t('title','A good title for this page')], $setCanonical, $checkDb);

You can invalidate the cache save records calling

\yii\caching\TagDependency::invalidate(Yii::$app->cache, gregory-coolich\seotools\Component::CACHE_TAG);

###URLs

URLs for the seotools manage module:

/seotools/manage
/seotools/manage/create

统计信息

  • 总下载量: 1.44k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-13