despark / igni-seo
Igni CMS SEO 包
v1.4.1
2018-02-07 15:12 UTC
Requires
- php: >=5.6.4
- davechild/textstatistics: 1.*
- doctrine/dbal: ^2.5
- illuminate/support: 5.3.*|5.4.*|5.5.*
- wa72/htmlpagedom: 1.3.*
Requires (Dev)
README
Despark 为 Laravel 5.3|5.4|5.5 开发的 igniCMS SEO 模块
安装
-
运行
composer require despark/igni-seo
-
在
config/app.php
中,在 application service providers 之前添加 igniCMS SEO 模块服务提供者,如下所示 (Laravel 5.5 可选)
示例
... /* * igniCMS Service Providers */ Despark\Cms\Seo\Providers\IgniSeoServiceProvider::class, /* * Package Service Providers... */ Laravel\Tinker\TinkerServiceProvider::class, ...
-
运行
php artisan vendor:publish --provider="Despark\Cms\Seo\Providers\IgniSeoServiceProvider"
。如果您使用的是 Laravel 5.3|5.4,将--provider
替换为--class
。 -
运行
php artisan migrate
将我们的 SEO 表添加到数据库。 -
在您的实体文件中,在
adminFormsField
中添加以下代码
'content' => [ 'type' => 'wysiwyg', 'label' => 'Content', ], 'readability' => [ 'type' => 'readability', 'for' => 'content', // This field is optional. Use it only if your column, that is going to be checked for readability, is not called content 'editorPosition' => 0, // The position of the desired editor, if you have more than one wysiwygs ], 'seo' => [ 'type' => 'seo', 'routeName' => 'articles.show', 'meta_title_field' => 'title', // This field is optional. Use it only if your column, which is going to be checked is not called title ],
- 将我们的 Traits 和 Interfaces 添加到您的 Model 中。
use Despark\Cms\Admin\Interfaces\UploadImageInterface; use Despark\Cms\Admin\Traits\AdminImage; use Despark\Cms\Models\AdminModel; use Despark\Cms\Seo\Contracts\Seoable; use Despark\Cms\Seo\Traits\HasSeo; class Article extends AdminModel implements Seoable, UploadImageInterface { use HasSeo; use AdminImage; protected $table = 'articles'; protected $fillable = [ 'title', 'slug', 'content', ]; protected $rules = [ 'title' => 'required', 'slug' => 'required', 'content' => 'required', ]; protected $identifier = 'article'; }
获取您的 SEO 数据
$seoData = $model->seo;
版权和许可证
igniCMS 是由 Despark 为 Laravel 框架编写的,并采用 MIT 许可证发布。有关详细信息,请参阅 LICENSE 文件。