amirax/yii2-seo-tools
最新稳定版本:v0.2.3
Composer 安装命令:
composer require amirax/yii2-seo-tools
包简介
SEO tools for Yii 2 framework
关键字:
README 文档
README
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require amirax/yii2-seo-tools "*"
or add
"amirax/yii2-seo-tools": "*"
to the require section of your composer.json file.
After installation extension run migration:
./yii migrate --migrationPath="@vendor/amirax/yii2-seo-tools/src/migrations"
Usage
SEO Meta
In components configuration add the following
'components' => [ 'seo' => [ 'class' => 'Amirax\SeoTools\Meta' ] ... ]
And add SEO extension to bootstrap
'bootstrap' => ['log', 'seo']
Extension will automatically load the correct row from the database using the currently running and params.You can optionally override data by specifying them in a parameter array
Yii::$app->seo->title = 'Page title'; Yii::$app->seo->metakeys = 'seo,yii2,extension'; Yii::$app->seo->metadesc = 'Page meta description'; Yii::$app->seo->tags['og:type'] = 'article';
You can set the templates for tags. For example:
Yii::$app->seo->setVar('USER_NAME', 'Amirax'); Yii::$app->seo->tags['og:title'] = 'Hello %USER_NAME%';
Default variables:
- %HOME_URL% - Homepage url
- %CANONICAL_URL% - Canonical URL for current page
- %LOCALE% - Site locale
SEO Redirect
For enabling SEO Redirect add to configuration file
'errorHandler' => [ 'class' => 'Amirax\SeoTools\Redirect', ],
统计信息
- 总下载量: 1.09k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 13
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-04-24