maks757 / yii2-seo
此包的最新版本(v1.1.0)没有可用的许可证信息。
Yii框架的SEO扩展
v1.1.0
2018-05-15 15:53 UTC
Requires
This package is not auto-updated.
Last update: 2024-09-20 22:58:35 UTC
README
Yii框架SEO优化模块
yii migrate --migrationPath=@vendor/maks757/yii2-seo/migrations
ActiveRecord配置行为
public function behaviors() { return [ 'seo_data' => [ 'class' => 'maks757\seo\behaviors\SeoDataBehavior', 'generation_field' => 'title' ], //... ]; }
添加规则
public function rules() { return [ //... [['seoUrl', 'seoTitle',], 'string', 'max' => 255], [['seoKeywords',], 'string', 'max' => 512], [['seoDescription',], 'string', 'max' => 1024], ]; }
您可以添加属性
/** * @property string $seoUrl * @property string $seoTitle * @property string $seoKeywords * @property string $seoDescriptin */
并将输入添加到表单中
<?= $form->field($model, 'seoUrl')->textInput() ?> <?= $form->field($model, 'seoTitle')->textInput() ?> <?= $form->field($model, 'seoDescription')->textarea() ?> <?= $form->field($model, 'seoKeywords')->textarea() ?>