gorriecoe/silverstripe-meta

Improves silverstripes html meta data options.

Installs: 7 593

Dependents: 1

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 5

Open Issues: 0

Type:silverstripe-vendormodule

2.0.2 2020-01-06 00:29 UTC

This package is auto-updated.

Last update: 2024-11-06 11:34:26 UTC


README

Improves silverstripes html meta data options.

Installation

Composer is the recommended way of installing SilverStripe modules.

composer require gorriecoe/silverstripe-meta

Requirements

  • silverstripe/cms ^4.0

Maintainers

Usage

Add the $MetaTags in the head as you would normally do in SilverStripe. The only difference is that $MetaTags can no longer be passed false to prevent the title tag

<head>
    {$MetaTags}
</head>

Modify title tag

If you want to modify title tag, include $meta_data variable with MetaTitle key in your page.

<?php
class MyPage extends Page
{
    private static $meta_data = [
        'MetaTitle' => [
            'MetaTitle',
            'Title',
            'SiteConfig.MetaTitle'
        ]
    ];
}

In the example above MetaTitle will use data from MetaTitle if found, if not it will fallback to Title and finally fall back to the SiteConfig MetaTitle.

Other modifiable tags include: MetaTitle, MetaDescription, MetaRobots, TwitterTitle, TwitterDescription, TwitterImage, TwitterSite, TwitterCreator, OGTitle, OGImage, OGImageType, OGUrl, OGDescription, OGSiteName, FBAuthor, FBPublisher, GplusAuthor and GplusPublisher