northug/yii2-meta-tags

Мета теги и тайтлы для моделей

Installs: 174

Dependents: 0

Suggesters: 0

Security: 0

Type:yii2-extension

1.0.0 2019-02-08 08:57 UTC

This package is auto-updated.

Last update: 2024-04-14 21:22:55 UTC


README

Add Meta Tags and Title in model

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist northug/yii2-meta-tags "*"

or add

"northug/yii2-meta-tags": "*"

to the require section of your composer.json file.

Migrate:

yii migrate --migrationPath=@northug/metaTags/migrations

Usage

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

Add MetaTagBehavior to your model, and configure it.

public function behaviors()
{
    return [
        'MetaTag' => [
            'class' => MetaTagBehavior::className(),
        ],
    ];
}

In form

<?= $form->field($model, 'meta')->widget(MetaTagsWidget::class)->label('SEO') ?>

and registar tags

$model = Model::findOne(1);

$model->getBehavior('MetaTag')->register();