chemezov/yii-seo

Search engine optimization for the Yii PHP framework.

Installs: 3 347

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 10

Open Issues: 0

Type:yii-extension

v1.0.4 2015-08-19 04:10 UTC

This package is auto-updated.

Last update: 2024-04-11 17:40:09 UTC


README

Search engine optimization for the Yii PHP framework.

Based on crisu83's yii-seo.

Usage

In layout

    <?php Yii::app()->controller->widget(
        'vendor.chemezov.yii-seo.widgets.SeoHead',
        array(
            'httpEquivs'         => array(
                'Content-Type'     => 'text/html; charset=utf-8',
                'X-UA-Compatible'  => 'IE=edge,chrome=1',
                'Content-Language' => 'en-EN'
            ),
            'defaultTitle'       => "My default title",
            'defaultDescription' => "My default description",
            'defaultKeywords'    => "My default keywords",
        )
    ); ?>

In Controller

    public function behaviors()
    {
        return array(
            'seo' => array('class' => 'vendor.chemezov.yii-seo.behaviors.SeoBehavior'),
        );
    }

    public function filters()
    {
        return array(
            array('vendor.chemezov.yii-seo.filters.SeoFilter + view'), // apply the filter to the view-action
        );
    }

In view file


$this->title = [$model->title, "My cool site!"];
$this->metaDescription = "My page description";
$this->metaKeywords = "My page keywords";