2017 © Pedro Peláez
 

yii2-extension yii2-seo

Handy module for managing seo attributes

image

mirkhamidov/yii2-seo

Handy module for managing seo attributes

  • Tuesday, April 11, 2017
  • by miroff
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

yii2-seo

Installation

The preferred way to install this extension is through composer., (*1)

Either run, (*2)

composer require mirkhamidov/yii2-seo "@dev"

or add, (*3)

"mirkhamidov/yii2-seo": "@dev"

to the require section of your composer.json file., (*4)

for run migrations add to your console config migrationNamespaces, (*5)

<?php
return [
    'controllerMap' => [
        'migrate' => [
            'class' => 'yii\console\controllers\MigrateController',
            'migrationNamespaces' => [
                'mirkhamidov\seo\migrations',
            ],
        ],
    ],
];

just run, (*6)

./yii migrate

Configure

Backend (manage)

add module to your config, (*7)

return [
    ...,
    'modules' => [
        ...,
        'seo' => 'mirkhamidov\seo\Module',
    ],
    ...,
];

Routes to Menu, (*8)

  • seo/page - to add new config for route
  • seo/attribute - to add more attributes

Frontend

add bootstap and component to your config, (*9)

return [
    'bootstrap' => [
        ..., 
        'seo',
    ],
    ...,
    'components' => [
        ...,
        'seo' => [
            'class' => 'mirkhamidov\seo\components\Seo'
        ],
    ],
    ...,
];

Layouts

title

<?php
if (is_null(Yii::$app->seo->tag('title'))) {
    echo '<title>' . Html::encode($this->title) . ' - ' . Yii::$app->name . '</title>';
} else {
    echo '<title>' . Html::encode(Yii::$app->seo->tag('title')) . '</title>';
}
?>

h1

<h1 class="main-title">
<?php
    if (is_null(Yii::$app->seo->tag('h1'))) {
        echo Html::encode($this->title);
    } else {
        echo Html::encode(Yii::$app->seo->tag('h1'));
    }
?>
</h1>

The Versions

11/04 2017

dev-master

9999999-dev

Handy module for managing seo attributes

  Sources   Download

MIT

The Requires

 

by Jasur Mirkhamidov

extension yii2 seo