PHPackages                             purplespider/silverstripe-basic-social-sharing - 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. purplespider/silverstripe-basic-social-sharing

ActiveSilverstripe-vendormodule

purplespider/silverstripe-basic-social-sharing
==============================================

Adds social media sharing fields to a Silverstripe site.

2.0.0(7mo ago)035BSD-3-ClausePHPPHP &gt;=8.3

Since Oct 25Pushed 7mo agoCompare

[ Source](https://github.com/purplespider/silverstripe-basic-social-sharing)[ Packagist](https://packagist.org/packages/purplespider/silverstripe-basic-social-sharing)[ Docs](https://github.com/purplespider/silverstripe-basic-social-sharing)[ RSS](/packages/purplespider-silverstripe-basic-social-sharing/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

Basic Social Sharing
====================

[](#basic-social-sharing)

Adds social media sharing fields to Silverstripe sites.

Description
-----------

[](#description)

This module adds social media meta tags for OpenGraph (Facebook) and Twitter to SiteTree and child page types. It also provides Title, Description and Image fields in the CMS to allow the default values to be overridden.

The module will look for Title, Description and Image values in the following order:

1. As entered in the fields of the provided "Social Media Sharing" section in the CMS.
2. The value of a specific field for a specific class, as configured in the YML (see below).
3. The value of the appropriate field from the CMS "Metadata" section.
4. The value from the "default" field, as specified in the module config. e.g. Page "Title" and "Content".

The module uses placeholder (and field description) text to indicate what values are being used, allowing you to then override them, only if necessary.

[![](screenshots/screenshot-1-defaults.png)](screenshots/screenshot-1-defaults.png)[![](screenshots/screenshot-2-completed.png)](screenshots/screenshot-2-completed.png)

Supported social media meta tags include:

- OpenGraph (Facebook)
    - `og:site_name`
    - `og:title`
    - `og:image`
    - `og:description`
    - `og:url`
- Twitter
    - `twitter:site`
    - `twitter:title`
    - `twitter:image`
    - `twitter:description`
    - `twitter:card`

Requirements
------------

[](#requirements)

SilverStripe 6

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

[](#installation)

1. `composer require purplespider/silverstripe-basic-social-sharing ^1.0`
2. run a `/dev/build?flush=all`
3. Without any configuration, the module will begin rendering social media meta tags for all page types.
4. Customise these on a per page/DO basis via the new "Social Media Sharing" section, below the existing "Metadata" section for pages.

Defaults
--------

[](#defaults)

By default, the module will use the following fields to populate the meta tags:

- `og:type` --&gt; `"website"`
- `og:site_name` --&gt; `SiteConfig.Title`
- `og:title` --&gt; `Title`
- `og:description` --&gt; `Content`
- `og:url` --&gt; `AbsoluteLink()`
- `twitter:title` --&gt; `Title`
- `twitter:description` --&gt; `Content`
- `twitter:card` --&gt; `"summary"`

NOTE: `twitter:card` will be set to `"summary"` by default, unless an image field is used. If an image field is used, the content will be set to `"summary_large_image"`.

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

[](#configuration)

Configure the module by editing `mysite/_config/config.yml` and set the following options:

```
PurpleSpider\BasicSocialSharing:
  default_title: 'Title'
  default_description: 'Content'
  twitter_site: ''
  titles:
    Fully\Namespaced\ClassName: 'FieldName'
    Fully\Namespaced\ClassName1: 'FieldName1'
  descriptions:
    Fully\Namespaced\ClassName: 'FieldName'
    Fully\Namespaced\ClassName1: 'FieldName1'
  images:
    Fully\Namespaced\ClassName: 'FieldName'
    Fully\Namespaced\ClassName1: 'FieldName1'
  types:
    Fully\Namespaced\ClassName: 'website'
    Fully\Namespaced\ClassName1: 'article'
```

- `default_title` - override the default title field to use; `PageTitle` is used by default.
- `default_description` - override the default description field to use; `MetaDescription` is used by default.
- `twitter_site` - the content to be used for thw `twitter:site` meta tag.
- `titles` - an array of class names, with the value being the name of the Text field to use for title meta tags. Useful for adding social media meta tag output to DataObjects.
- `descriptions` - an array of class names, with the value being the name of the Text field to use for description meta tags. Useful for adding social media meta tag output to DataObjects.
- `images` - an array of class names, with the value being the name of the Image field to use for image meta tags. Useful for adding social media meta tag output to DataObjects.
- `types` - an array of class names, with the value being the content to use for `og:type` met tag.

Example `config.yml`
--------------------

[](#example-configyml)

```
PurpleSpider\BasicSocialSharing:
  default_title: 'PageTitle'
  default_description: ''
  titles:
    PurpleSpider\Models\Category: 'Name'
    PurpleSpider\Models\Product: 'Name'
    PurpleSpider\Models\Recipe: 'Name'
  descriptions:
    PurpleSpider\Models\Category: 'ShortDescr'
    PurpleSpider\Models\Product: 'Summary'
    PurpleSpider\Models\Recipe: 'MetaDescription'
  images:
    PurpleSpider\Pagetypes\AboutUsPage: 'LogoImage'
    PurpleSpider\Models\Category: 'BeautyShot'
    PurpleSpider\Models\Product: 'BeautyShot'
    PurpleSpider\Models\Recipe: 'Image'
  types:
    PurpleSpider\Models\Recipe: 'article'
  twitter_site: ''
```

Silverstripe Blog Module Support
--------------------------------

[](#silverstripe-blog-module-support)

Add the following to a `config.yml`:

```
PurpleSpider\BasicSocialSharing:
  images:
    SilverStripe\Blog\Model\BlogPost: "FeaturedImage"
  types:
    SilverStripe\Blog\Model\BlogPost: "article"
```

Adding social media meta tags to DataObjects
--------------------------------------------

[](#adding-social-media-meta-tags-to-dataobjects)

By default, this module will only add social media meta tags to SiteTree objects.

To add social media meta tags to DataObjects:

- in `_config/config.yml`, add the extension to each DataObject class you wish:

```
Fully\Namespaced\Dataobject:
  extensions:
    - PurpleSpider\BasicSocialSharing\BasicSocialSharingExtension
```

- in `_config/config.yml`, set options for `titles`, `descriptions`, and `images` (if desired) for your class.
    - for an example, see the above example `config.yml`.
- in your DataObject's class, add new fields in `getCMSFields()`:

```
  public function getCMSFields() {
      $fields = parent::getCMSFields();

      ...

      $fields->addFieldToTab('Root.Main', new TextareaField("SocialMetaDescription"));
      $fields->addFieldToTab('Root.Main', new UploadField("SocialMetaImage"));

      return $fields;
  }
```

- run a `/dev/build?flush=all`

License
-------

[](#license)

This project is licensed under the [New BSD License](./LICENSE)

Original Module
---------------

[](#original-module)

This is a heavily modified and more opinionated version of . Huge thanks to Innis for the development of the key functionality.

###  Health Score

40

—

FairBetter than 87% of packages

Maintenance68

Regular maintenance activity

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 76.9% 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 ~141 days

Recently: every ~177 days

Total

6

Last Release

218d ago

Major Versions

1.1.0 → 2.0.02025-10-03

PHP version history (2 changes)1.0.0PHP &gt;=5.6

2.0.0PHP &gt;=8.3

### Community

Maintainers

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

---

Top Contributors

[![purplespider](https://avatars.githubusercontent.com/u/329880?v=4)](https://github.com/purplespider "purplespider (10 commits)")[![kevin-hine-innis](https://avatars.githubusercontent.com/u/83420315?v=4)](https://github.com/kevin-hine-innis "kevin-hine-innis (3 commits)")

---

Tags

silverstripesocial mediameta-tags

### Embed Badge

![Health badge](/badges/purplespider-silverstripe-basic-social-sharing/health.svg)

```
[![Health](https://phpackages.com/badges/purplespider-silverstripe-basic-social-sharing/health.svg)](https://phpackages.com/packages/purplespider-silverstripe-basic-social-sharing)
```

###  Alternatives

[silvershop/core

Provides an ecommerce product catalog, shopping cart, and order management system

11340.0k37](/packages/silvershop-core)[jonom/silverstripe-share-care

Social media sharing previews and customisation for Silverstripe

2932.7k1](/packages/jonom-silverstripe-share-care)[silverstripe-terraformers/gridfield-rich-filter-header

Rich filter header component for GridField

1325.7k1](/packages/silverstripe-terraformers-gridfield-rich-filter-header)[sunnysideup/ecommerce

Silverstripe E-commerce Application

257.2k79](/packages/sunnysideup-ecommerce)

PHPackages © 2026

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