定制 roseblade/businessdata 二次开发

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

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

roseblade/businessdata

最新稳定版本:0.0.2

Composer 安装命令:

composer require roseblade/businessdata

包简介

Adds standard business data to the website

README 文档

README

A Silverstripe module that adds business contact details, structured data (JSON-LD), favicon generation, and social network links to your site via SiteConfig.

Features

  • Business name, description, legal name, address, telephone, and email fields on SiteConfig
  • Automatic geo-coordinates lookup from postcode via the Postcodes.io API
  • JSON-LD structured data (schema.org) injected into page <head> — supports Organization, LocalBusiness, and Event types
  • Favicon generation at multiple sizes from a single uploaded image, injected as <link> tags
  • Social network links (stored as SocialNetwork records, exposed as sameAs in JSON-LD)

Requirements

  • Silverstripe CMS ^6.0
  • PHP ^8.1

Installation

composer require roseblade/businessdata

Run a database build after installation:

vendor/bin/sake db:build

or by visiting /dev/build?flush=all in your browser

Configuration

JSON-LD structured data

By default, JSON-LD is only output on the home page. You can change this in YAML:

Silverstripe\CMS\Model\SiteTree:
  include_site_jsonld: home   # 'home' (default) or 'all'

To disable minification of the JSON-LD output (good for debugging purposes):

Roseblade\BusinessData\DataExtension\SiteTreeExtension:
  minify_jsonld: false

You can also control inclusion on a per-page basis in PHP:

$page->setIncludeSiteSchemaData(true);  // force include
$page->setIncludeSiteSchemaData(false); // force exclude

Favicon

Upload a favicon image via Settings > Business > Branding in the CMS. The module will automatically generate and inject <link> tags at the following sizes: 16×16, 32×32, 96×96, 180×180, 300×300, and 512×512.

The default behaviour pads the image to a square with a white fill. You can override the fill colour or use a different resize function:

Roseblade\BusinessData\DataExtension\SiteTreeExtension:
  icon_fill: "#000000"         # background fill colour for padding (default: #ffffff)
  icon_size_function: pad      # Silverstripe image manipulation method (default: pad)

To customise which icon sizes and <link> attributes are generated:

Roseblade\BusinessData\DataExtension\SiteTreeExtension:
  icons:
    - rel: icon
      sizes: 32x32
      type: "{getMimeType}"
    - rel: apple-touch-icon
      sizes: 180x180
      type: "{getMimeType}"

Values wrapped in {} are resolved as method calls on the generated image object (e.g. {getMimeType} calls $image->getMimeType()).

Geo-coordinates

When a postcode is saved on SiteConfig, the module will automatically look up the latitude and longitude via the Postcodes.io API. To disable this:

Roseblade\BusinessData\DataExtension\SiteConfigExtension:
  update_geodata_by_api: false

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2024-11-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固