PHPackages                             netwerkstatt/silverstripe-opengraph-extension - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. netwerkstatt/silverstripe-opengraph-extension

ActiveSilverstripe-vendor-module[Utility &amp; Helpers](/categories/utility)

netwerkstatt/silverstripe-opengraph-extension
=============================================

Extends tractorcow/silverstripe-opengraph with better image handling (FocusPoint), Twitter cards, and Schema.org support.

0.3.1(1mo ago)014BSD-3-ClausePHPPHP ^8.1

Since Mar 10Pushed 1mo agoCompare

[ Source](https://github.com/wernerkrauss/silverstripe-opengraph-extension)[ Packagist](https://packagist.org/packages/netwerkstatt/silverstripe-opengraph-extension)[ RSS](/packages/netwerkstatt-silverstripe-opengraph-extension/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (7)Versions (5)Used By (0)

Silverstripe OpenGraph Extension
================================

[](#silverstripe-opengraph-extension)

Extends [tractorcow/silverstripe-opengraph](https://github.com/tractorcow/silverstripe-opengraph) with advanced image handling, CMS previews, Elemental support, and Schema.org integration.

Features
--------

[](#features)

- **Advanced Image Handling**: Automatically resizes images to 1200x630px using `FocusFill()` (if `jonom/silverstripe-focuspoint` is installed) or `Fill()`.
- **Watermark Support**: Automatically applies watermarks if configured in `SiteConfig` (requires `netwerkstatt/silverstripe-image-toolkit`).
- **SiteConfig Integration**: Adds global fields for a default Open Graph image and an optional watermark logo.
- **CMS Preview**: Adds a real-time Social Media preview in the "OpenGraph" tab of the CMS, including warnings for missing content.
- **Elemental Support**: Automatically generates `og:description` from Elemental blocks if the main content field is empty.
- **Twitter Cards**: Automatically generates `twitter:card` (summary\_large\_image).
- **OG Dimensions**: Includes `og:image:width` and `og:image:height` for faster preview generation on first share.
- **Schema.org (JSON-LD)**: Provides a framework for JSON-LD, with optional `spatie/schema-org` support.

Extensions
----------

[](#extensions)

### OpenGraphImageExtension

[](#opengraphimageextension)

Adds a `OGImageCustom` field to pages for specific Open Graph images. It also provides the `getOGImage()` hook for the builder and the CMS preview.

- **Target**: `Page`

### SiteConfigOpenGraphExtension

[](#siteconfigopengraphextension)

Adds global settings for a default Open Graph image and a watermark logo (requires `silverstripe-image-toolkit`).

- **Target**: `SilverStripe\SiteConfig\SiteConfig`

### ElementalOpenGraphExtension

[](#elementalopengraphextension)

Provides an optimized `getOGDescription()` for pages using Silverstripe Elemental. It uses `getElementsForSearch()` to aggregate content from blocks.

- **Target**: Classes with `ElementalPageExtension`

### OpenGraphBuilderExtension

[](#opengraphbuilderextension)

Extends the `OpenGraphBuilder` to include Twitter card types and image dimensions.

- **Target**: `TractorCow\OpenGraph\ObjectBuilders\OpenGraphBuilder`

### SchemaExtension

[](#schemaextension)

Injects JSON-LD into the page head.

- **Target**: `Page` and `ContentController`

### SiteTreeSchemaGraphExtension

[](#sitetreeschemagraphextension)

Provides a default `WebPage` node for all `SiteTree` records using `spatie/schema-org`.

- **Target**: `SilverStripe\CMS\Model\SiteTree`

Installation
------------

[](#installation)

With composer:

```
composer require netwerkstatt/silverstripe-opengraph-extension
```

Configuration
-------------

[](#configuration)

The module is pre-configured to apply to all `Page` objects. You can customise the image dimensions in YAML:

```
Netwerkstatt\OpenGraph\Extension\OpenGraphImageExtension:
  og_image_width: 1200
  og_image_height: 630
```

### Elemental Integration

[](#elemental-integration)

If you want to explicitly enable Elemental support for a specific page type:

```
Netwerkstatt\Site\Page\BlockPage:
  extensions:
    - Netwerkstatt\OpenGraph\Extension\ElementalOpenGraphExtension
```

Schema.org Customization
------------------------

[](#schemaorg-customization)

The schema graph follows an extension-first provider/orchestrator pattern:

- The module orchestrates graph creation in `GraphSchemaBuilder`.
- Project code contributes nodes via dedicated extensions/providers.
- No schema-specific methods are required in project base classes like `Page` or `PageController`.

#### Contributor hooks

[](#contributor-hooks)

- `updateSchemaGraphContributors(array &$contributors, SiteTree $page, SiteConfig $siteConfig)`
- `updateSchemaGraphItems(array &$items, SiteTree $page, SiteConfig $siteConfig)`
- `updateSchemaGraphNodes(array &$nodes, SiteTree $page, SiteConfig $siteConfig)`

#### Safe project examples

[](#safe-project-examples)

Example 1: Add a project-specific provider (e.g. on `SiteConfig`):

```
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Core\Extension;
use Spatie\SchemaOrg\BaseType;
use Spatie\SchemaOrg\Schema;

class SiteConfigSchemaExtension extends Extension
{
    /**
     * @return array
     */
    public function provideSchemaGraphNodes(SiteTree $page): array
    {
        $website = Schema::webSite()
            ->name($this->getOwner()->Title)
            ->url($page->getAbsoluteBaseURL());

        return [$website];
    }
}
```

Example 2: Collect block items via a dedicated page extension:

```
use Netwerkstatt\Site\Page\BlockPage;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Core\Extension;

class BlockPageSchemaItemsExtension extends Extension
{
    /**
     * @param array $items
     */
    public function updateSchemaGraphItems(array &$items, SiteTree $page): void
    {
        if (!$page instanceof BlockPage) {
            return;
        }

        foreach ($page->ElementalArea()->Elements() as $element) {
            $items[] = $element;
        }
    }
}
```

Example 3: Let each block/model provide its own node:

```
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\SiteConfig\SiteConfig;
use Spatie\SchemaOrg\BaseType;
use Spatie\SchemaOrg\Schema;

class RoomType extends DataObject
{
    /**
     * @return array
     */
    public function provideSchemaGraphNodes(SiteTree $page, SiteConfig $siteConfig): array
    {
        $node = Schema::hotelRoom()->name($this->Title);
        return [$node];
    }
}
```

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance90

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~20 days

Total

4

Last Release

47d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ff3ee546a6d1b1092f1badf68523ba30f28dec7fce11254a8cb3aeb57c6202de?d=identicon)[wernerkrauss](/maintainers/wernerkrauss)

---

Top Contributors

[![wernerkrauss](https://avatars.githubusercontent.com/u/1043925?v=4)](https://github.com/wernerkrauss "wernerkrauss (13 commits)")

### Embed Badge

![Health badge](/badges/netwerkstatt-silverstripe-opengraph-extension/health.svg)

```
[![Health](https://phpackages.com/badges/netwerkstatt-silverstripe-opengraph-extension/health.svg)](https://phpackages.com/packages/netwerkstatt-silverstripe-opengraph-extension)
```

###  Alternatives

[symbiote/silverstripe-advancedworkflow

Adds configurable workflow support to the CMS, with a GUI for creating custom workflow definitions.

46299.9k9](/packages/symbiote-silverstripe-advancedworkflow)[lekoala/silverstripe-cms-actions

Add actions to your models in SilverStripe

39317.0k29](/packages/lekoala-silverstripe-cms-actions)[withcandour/aardvark-seo

Save time and get your Statamic site to rank better with the SEO addon for Statamic.

15131.5k](/packages/withcandour-aardvark-seo)[justkidding96/aardvark-seo

Save time and get your Statamic site to rank better with the SEO addon for Statamic.

144.1k](/packages/justkidding96-aardvark-seo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
