porcelanosa / yii2-seo-attributes
Yii2 Extenstion for set seo attributes
Installs: 111
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.4.0
- kartik-v/yii2-tabs-x: *
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2025-01-02 03:32:06 UTC
README
WARNING! This package is UNDER DEVELOPMENT
yii2-seo-attributes
Yii2 extensions for adding seo attributes, like a title, meta-keys, meta-descr and other, in entity ##Installition
composer require porcelanosa/yii2-seo-attributes
Run migration
$ php yii migrate/up --migrationPath=@vendor/porcelanosa/yii2-seo-attributes/migrations
In model class add behavior
'seoBehavior' => [ 'class' => SeoBehavior::className(), 'model_name' => $this::className(), 'uploadPath' =>'@web/uploads/seoimage/' ],
In config add module
'modules' => [ ... 'seo' => [ 'class' => 'porcelanosa\yii2seo\Module', 'uploadPath' =>'@web/uploads/seoimage/' ], ... ]
In admin view
echo \porcelanosa\yii2seo\SeoWidget::widget( [ 'model' => $model, 'form' => $form, 'behaviorName' => 'seoBehavior', 'templateType' => 'minimum-minimorum' // 'minimal', 'standart', 'full' ] );
##Usage
$this->title = $model->seo->title;
or meta-tag
$this->registerMetaTag([ 'name' => 'description', 'content' => $model->seo->meta_descr] );
or in controller action
if ($model->seo) { // page title $this->getView()->title = $model->seo->title; // meta keywords $this->getView()->registerMetaTag([ 'name' => 'description', 'content' => $model->seo->meta_descr, ]) ; }
##Social meta tags Examples of using
https://moz.com/blog/meta-data-templates-123
or
http://www.iacquire.com/blog/18-meta-tags-every-webpage-should-have-in-2013
Twitter Card docs
https://dev.twitter.com/cards/overview
Open Graph docs
https://developers.facebook.com/docs/opengraph/getting-started
Google Schema.org docs
https://developers.google.com/+/web/snippet/
Schema.org types
http://schema.org/docs/schemas.html
Template Types
Extension provide tmplate type: 'only2', 'minimum', 'standart', 'full'