hashandsalt/kirby4-seo
最新稳定版本:v1.0.1
Composer 安装命令:
composer require hashandsalt/kirby4-seo
包简介
Kirby 4 - SEO tools
README 文档
README
A small plugin for generating metadata using shared controllers and field data. Also creates Facebook Opengraph and Twitter social sharing information.
Installation
Manual
To use this plugin, place all the files in site/plugins/kirby3-seo.
Composer
composer require hashandsalt/kirby4-seo
Commerical Usage
This plugin is free but if you use it in a commercial project please consider to
Usage
After installing the plugin, set up the controllers to bring the shared SEO controller into each of your template controllers.
The bare minimum controller looks like this:
<?php
return function ($page, $kirby, $site) {
// SEO
$seo = $kirby->controller('seo' , compact('page', 'site', 'kirby'));
return $seo;
};
To override any of the values, you can do this inside your controller. For example, to change the format of the meta title, you could do this:
<?php
return function ($page, $kirby, $site) {
// Meta
$seo = $kirby->controller('seo' , compact('page', 'site', 'kirby'));
// Override Meta Title
$metatitle = $page->seotitle().' | '.$site->title();
$data = compact('metatitle');
return a::merge($seo, $data);
};
Additionally, you need to populate the pages with information that is needed for the meta tags to be filled out correctly. The plugin contains blueprints for this and is meant to be used as tabs on your pages:
title: Default
tabs:
# SEO META
meta: tabs/seo/meta
In the site.yml also set up the contact tab which will capture social media account information.
title: Site
tabs:
# Contact
contact: tabs/seo/contact
Finally, output the meta tags in your templates with the following snippet.
<?= snippet('seo/meta') ?>
For convenience the plugin also contains a favicon snippet:
<?= snippet('seo/favicon') ?>
You can generate the favicons at this website link
Generating JSON Schema data
To generate any kind of schema data, you can use our Schema plugin in tandem with this plugin.
统计信息
- 总下载量: 161
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-12-21