PHPackages                             creativecodelabs/silverstripe-social-meta-tags - 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. creativecodelabs/silverstripe-social-meta-tags

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

creativecodelabs/silverstripe-social-meta-tags
==============================================

Adds social media meta tags to Silverstripe sites.

1.0(8y ago)0371GPL-3.0-onlyPHP

Since Apr 12Pushed 8y agoCompare

[ Source](https://github.com/CreativeCodeLabs/silverstripe-social-meta-tags)[ Packagist](https://packagist.org/packages/creativecodelabs/silverstripe-social-meta-tags)[ RSS](/packages/creativecodelabs-silverstripe-social-meta-tags/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Silverstripe Social Meta Tags
=============================

[](#silverstripe-social-meta-tags)

Adds social media meta tags to Silverstripe sites.

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

[](#description)

**silverstripe-social-meta-tags** adds social media meta tags for OpenGraph (Facebook) and Twitter to SiteTree and child page types.

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 3.5+

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

[](#installation)

1. `composer require creativecodelabs/silverstripe-social-meta-tags`
2. run a `/dev/build?flush=all`
3. Without any configuration, the module will begin rendering social media meta tags for all page types.

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; `MetaDescription`
- `og:url` --&gt; `AbsoluteLink()`
- `twitter:title` --&gt; `Title`
- `twitter:description` --&gt; `MetaDescription`
- `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:

```
SocialMetaTags:
  default_title: 'PageTitle'
  default_description: 'MetaDescription'
  meta_description_default: true
  twitter_site: ''
  titles:
    ClassName: 'FieldName'
    ClassName1: 'FieldName1'
  descriptions:
    ClassName: 'FieldName'
    ClassName1: 'FieldName1'
  images:
    ClassName: 'FieldName'
    ClassName1: 'FieldName1'
  types:
    ClassName: 'website'
    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.
- `meta_description_default` - flag that indicates whether to fall back to `MetaDescription` if the chosen description field is empty.
- `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)

```
SocialMetaTags:
  default_title: 'PageTitle'
  default_description: ''
  meta_description_default: true
  titles:
    Category: 'Name'
    Product: 'Name'
    Recipe: 'Name'
  descriptions:
    Category: 'ShortDescr'
    Product: 'Summary'
    Recipe: 'MetaDescription'
  images:
    AboutUsPage: 'LogoImage'
    Category: 'BeautyShot'
    Product: 'BeautyShot'
    Recipe: 'Image'
  types:
    Recipe: 'article'
  twitter_site: ''
```

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 `/mysite/_config.php`, add the extension to each DataObject class you wish.
    - e.g. `Recipe::add_extension('SocialMetaTagsExtension');`
- in `/mysite/_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 [GPL v3](./LICENSE)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

Unknown

Total

1

Last Release

2952d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/01fc4b18c9d38958298a3d45de6808af0804bb81a606e9ea390a23b717618c0c?d=identicon)[creativecodelabs](/maintainers/creativecodelabs)

---

Top Contributors

[![jchenevey](https://avatars.githubusercontent.com/u/8449994?v=4)](https://github.com/jchenevey "jchenevey (9 commits)")

### Embed Badge

![Health badge](/badges/creativecodelabs-silverstripe-social-meta-tags/health.svg)

```
[![Health](https://phpackages.com/badges/creativecodelabs-silverstripe-social-meta-tags/health.svg)](https://phpackages.com/packages/creativecodelabs-silverstripe-social-meta-tags)
```

###  Alternatives

[silverstripe/multi-domain

Allows multiple domains to access one CMS instance, mapping them to different sections of the hierarchy

141.6k](/packages/silverstripe-multi-domain)

PHPackages © 2026

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