定制 pensoft/oc-meta-plugin 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

pensoft/oc-meta-plugin

最新稳定版本:1.0.2

Composer 安装命令:

composer require pensoft/oc-meta-plugin

包简介

Provides an easy interface to insert HTML meta and link tags into an October CMS layout or page.

README 文档

README

Please note that this repository is no longer being maintained.
Due to a disagreement with the founders of October CMS, I will no longer be providing updates for the October CMS version of this plugin. I will keep the repository available for people to use, but will only be updating the Winter CMS version of this plugin.


Meta plugin

Provides an easy interface to allow October CMS plugins to insert HTML <meta> and <link> tags, as well as JSON-LD blocks into a layout or page. The plugin provides three helper classes to populate the meta and link tags or JSON-LD blocks, and a component each to inject them into an October CMS layout, partial or page file.

Usage

For theme developers

Three components are provided to inject the meta and link tags or JSON-LD blocks into your theme - metaList, linkList and jsonLdList.

Meta tags

Add the Meta -> Meta List component to your page and add the following line where you would like the meta tags to be inserted. This should preferably be inside the <head> tag.

{% component 'metaList' %}

Meta tags will be generated in the following structure:

<meta name="(name)" content="(value)">

Two options are also provided with the component:

  • Include page meta?: If ticked (default), the meta title and description fields provided by October CMS will be also be included in the generated meta tags.
  • Escape tag values?: If ticked (default), the values inserted into the content attribute will be escaped using htmlentities. If this messes up your content, you can untick this to insert the raw content instead.

Link tags

Add the Meta -> Link List component to your page and add the following line where you would like the link tags to be inserted. As above, this should also preferably be inside the <head> tag.

{% component 'linkList' %}

Link tags will be generated in the following structure:

<link rel="(name)" href="(value)">

An option is also provided with the component:

  • Escape tag values?: If ticked (default), the values inserted into the href attribute will be escaped using htmlentities. If this messes up your content, you can untick this to insert the raw content instead.

JSON-LD blocks

Add the Meta -> JSON-LD List component to your page and add the following line where you would like the JSON-LD blocks to be inserted. As above, this should also preferably be inside the <head> tag, beneath all <meta> and <link> tags.

{% component 'jsonLdList' %}

JSON-LD blocks will be generated in the following structure:

<script type="application/ld+json">
    (value)
</script>

An option is also provided with the component:

  • Escape JSON-LD content?: If ticked (default), the values inserted into the JSON-LD content blocks will be escaped using htmlentities. If this messes up your content - especially in the case of HTML content, you can untick this to insert the raw content instead.

For plugin developers

If you wish to use this plugin to provide meta and link tags or JSON-LD block content on sites that your plugin is installed on, you can use the \BennoThommo\Meta\Meta, \BennoThommo\Meta\Link and \BennoThommo\Meta\JsonLd helper classes in your plugin.

These classes can be used up until the point in which the components above are rendered in October CMS.

Meta tags

To add a Meta tag, use the following line:

\BennoThommo\Meta\Meta::set('name', 'value')

where name is the name of the meta tag and value is the content of the meta tag.

You can also add several meta tags at once:

\BennoThommo\Meta\Meta::set([
    'name1' => 'value1',
    'name2' => 'value2'
]);

Note that only one value can be used per name. If the same name is used in a more recent call to the helper, the given value will overwrite any previous values.

Link tags

To add a Link tag, use the following line:

\BennoThommo\Meta\Link::set('name', 'value')

where name is the name of the link tag and value is the href of the link tag.

You can also add several link tags at once:

\BennoThommo\Meta\Link::set([
    'name1' => 'value1',
    'name2' => 'value2'
]);

Note that only one value can be used per name. If the same name is used in a more recent call to the helper, the given value will overwrite any previous values.

JSON-LD blocks

To add a JSON-LD block, use the following line:

\BennoThommo\Meta\JsonLd::set('name', '{key: value}')

where name is the name of the JSON-LD block and value is the JSON-encoded content you wish to use in the block.

All provided values will be checked to ensure they are valid JSON - if a value provided is not valid JSON content, an ApplicationException will be thrown.

You can also add several JSON-LD blocks at once:

\BennoThommo\Meta\JsonLd::set([
    'name1' => '{key1: value1}',
    'name2' => '{key2: value2}'
]);

pensoft/oc-meta-plugin 适用场景与选型建议

pensoft/oc-meta-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「plugin」 「cms」 「html」 「link」 「meta」 「october」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 pensoft/oc-meta-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 pensoft/oc-meta-plugin 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-05