2017 © Pedro Peláez
 

yii2-extension yii2-seo-attributes

Yii2 Extenstion for set seo attributes

image

porcelanosa/yii2-seo-attributes

Yii2 Extenstion for set seo attributes

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

WARNING! This package is UNDER DEVELOPMENT, (*1)

Latest Stable Version Latest Unstable Version Total Downloads License composer.lock, (*2)

yii2-seo-attributes

Yii2 extensions for adding seo attributes, like a title, meta-keys, meta-descr and other, in entity, (*3)

Installition

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'
    ] );

Usage

$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,
    ])
    ;
}

Screen shot, (*10)

Social meta tags

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)

Twitter Card docs

https://dev.twitter.com/cards/overview, (*15)

Open Graph docs

https://developers.facebook.com/docs/opengraph/getting-started, (*16)

Google Schema.org docs

https://developers.google.com/+/web/snippet/, (*17)

Schema.org types

http://schema.org/docs/schemas.html, (*18)

Template Types

Extension provide tmplate type: 'only2', 'minimum', 'standart', 'full', (*19)

Full decription of template types, (*20)

The Versions

24/07 2016

dev-master

9999999-dev https://github.com/porcelanosa/yii2-seo-attributes

Yii2 Extenstion for set seo attributes

  Sources   Download

MIT

The Requires

 

by Alex Porcelanosa

yii2 yii yii 2 seo