dev-master
9999999-dev https://github.com/porcelanosa/yii2-seo-attributesYii2 Extenstion for set seo attributes
MIT
The Requires
- php >=5.4.0
- yiisoft/yii2 *
- kartik-v/yii2-tabs-x *
by Alex Porcelanosa
yii2 yii yii 2 seo
Wallogit.com
2017 © Pedro Peláez
Yii2 Extenstion for set seo attributes
WARNING! This package is UNDER DEVELOPMENT, (*1)
Yii2 extensions for adding seo attributes, like a title, meta-keys, meta-descr and other, in entity, (*3)
composer require porcelanosa/yii2-seo-attributes
Run migration, (*4)
$ php yii migrate/up --migrationPath=@vendor/porcelanosa/yii2-seo-attributes/migrations
In model class add behavior, (*5)
'seoBehavior' => [
'class' => SeoBehavior::className(),
'model_name' => $this::className(),
'uploadPath' =>'@web/uploads/seoimage/'
],
In config add module, (*6)
'modules' => [
...
'seo' => [
'class' => 'porcelanosa\yii2seo\Module',
'uploadPath' =>'@web/uploads/seoimage/'
],
...
]
In admin view, (*7)
echo \porcelanosa\yii2seo\SeoWidget::widget(
[
'model' => $model,
'form' => $form,
'behaviorName' => 'seoBehavior',
'templateType' => 'minimum-minimorum' // 'minimal', 'standart', 'full'
] );
$this->title = $model->seo->title;
or meta-tag, (*8)
$this->registerMetaTag([
'name' => 'description',
'content' => $model->seo->meta_descr]
);
or in controller action, (*9)
if ($model->seo) {
// page title
$this->getView()->title = $model->seo->title;
// meta keywords
$this->getView()->registerMetaTag([
'name' => 'description',
'content' => $model->seo->meta_descr,
])
;
}
, (*10)
Examples of using, (*11)
https://moz.com/blog/meta-data-templates-123, (*12)
or, (*13)
http://www.iacquire.com/blog/18-meta-tags-every-webpage-should-have-in-2013, (*14)
https://dev.twitter.com/cards/overview, (*15)
https://developers.facebook.com/docs/opengraph/getting-started, (*16)
https://developers.google.com/+/web/snippet/, (*17)
http://schema.org/docs/schemas.html, (*18)
Extension provide tmplate type: 'only2', 'minimum', 'standart', 'full', (*19)
Yii2 Extenstion for set seo attributes
MIT
yii2 yii yii 2 seo