benjaminhaeberli/kirby-seo 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

benjaminhaeberli/kirby-seo

Composer 安装命令:

composer require benjaminhaeberli/kirby-seo

包简介

🔎 Minimal SEO plugin for Kirby CMS – for PHP lovers.

README 文档

README

Logo of Kirby SEO
Minimal SEO plugin for Kirby CMS

Build Status Total Downloads Latest Stable Version License

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

MIT

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 我们能提供哪些服务?
定制开发 / 二次开发

基于 benjaminhaeberli/kirby-seo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 918
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-30