benjaminhaeberli/kirby-seo
Composer 安装命令:
composer require benjaminhaeberli/kirby-seo
包简介
🔎 Minimal SEO plugin for Kirby CMS – for PHP lovers.
关键字:
README 文档
README
Minimal SEO plugin for Kirby CMS
Features
- Meta tags (title, description, keywords, robots, canonical URL)
- Open Graph tags (title, type, site name, URL, image, description, locale)
- Twitter Card tags (title, card, site, creator, image, description)
- Automatic image cropping to 1200x630 for social sharing
- Panel blueprints for page-level and site-level SEO fields
- Multi-language support (locale detection)
- Conditional rendering (empty fields produce no HTML output)
Requirements
- PHP ^8.2
- Kirby ^4.0.1 or ^5.0
Installation
composer require benjaminhaeberli/kirby-seo
Usage
1. Add the site-level blueprint
In your site.yml blueprint, include the SEO fields for global settings (site title, OG image, Twitter handles):
# site/blueprints/site.yml tabs: seo: label: SEO fields: seo: fields/seo/site
2. Add the page-level blueprint
In any page blueprint, include the SEO fields (meta title, description, keywords, canonical URL):
# site/blueprints/pages/default.yml tabs: seo: label: SEO fields: seo: fields/seo/meta
3. Render the meta tags
In your header.php snippet (or equivalent), add the SEO snippet inside <head>:
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php snippet('seo/meta') ?>
</head>
Output example
The snippet generates the following HTML (tags with empty values are omitted):
<base href="https://example.com"> <title>Page title</title> <meta content="Page description." name="description"> <meta content="keyword1, keyword2" name="keywords"> <meta content="index, follow, noodp" name="robots"> <link href="https://example.com/canonical" rel="canonical"> <meta content="Page title" property="og:title"> <meta content="website" property="og:type"> <meta content="My Site" property="og:site_name"> <meta content="https://example.com/page" property="og:url"> <meta content="https://example.com/image.jpg" property="og:image"> <meta content="Page description." property="og:description"> <meta content="fr_FR" property="og:locale"> <meta content="Page title" name="twitter:title"> <meta content="summary_large_image" name="twitter:card"> <meta content="@site" name="twitter:site"> <meta content="@creator" name="twitter:creator"> <meta content="https://example.com/image.jpg" name="twitter:image"> <meta content="Page description." name="twitter:description">
Panel fields
Site-level (fields/seo/site)
| Field | Type | Description |
|---|---|---|
| Site title | text |
Used as og:site_name |
| Image | files |
OG/Twitter image (cropped to 1200x630) |
| Twitter (Creator) | text |
@handle of the content author |
| Twitter (Site) | text |
@handle of the website |
Page-level (fields/seo/meta)
| Field | Type | Description |
|---|---|---|
| Meta title | text |
<title> and og:title |
| Meta description | textarea |
<meta name="description"> and og:description |
| Keywords | tags |
<meta name="keywords"> |
| Canonical URL | url |
<link rel="canonical"> (defaults to site URL) |
Panel translations
Blueprint labels and help texts use Kirby's plugin translations system. English and French are included.
To add a new language, create a file in translations/ (e.g. de.php) following the same format as en.php, and register it in index.php. Contributions are welcome via pull request.
Development
composer install composer test # Run all checks (rector, pint, phpstan, pest) composer test:unit # Run Pest tests only composer test:types # Run PHPStan only composer lint # Run Pint code formatter composer refacto # Run Rector refactoring
Inspiration
License
benjaminhaeberli/kirby-seo 适用场景与选型建议
benjaminhaeberli/kirby-seo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 918 次下载、GitHub Stars 达 4, 最近一次更新时间为 2023 年 05 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「seo」 「kirby」 「kirby-plugin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 benjaminhaeberli/kirby-seo 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 benjaminhaeberli/kirby-seo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 benjaminhaeberli/kirby-seo 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Help to manage meta data on Laravel Eloquent model
Zero-dependency global `kirbylog()` helper for any content
Courier offers a convenient and painless solution for creating emails tailored for your Kirby website.
Statamic Fine Seo addon
Blade template for Kirby
Search Kirby with Loupe
统计信息
- 总下载量: 918
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-05-30