Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arillo/silverstripe-metatags
Better metatags for your SilverStripe Projects.
https://github.com/arillo/silverstripe-metatags
meta-tags php seo silverstripe
Last synced: about 1 month ago
JSON representation
Better metatags for your SilverStripe Projects.
- Host: GitHub
- URL: https://github.com/arillo/silverstripe-metatags
- Owner: arillo
- License: mit
- Created: 2017-02-23T15:03:33.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-04-19T18:38:24.000Z (over 1 year ago)
- Last Synced: 2024-10-28T17:18:08.833Z (about 2 months ago)
- Topics: meta-tags, php, seo, silverstripe
- Language: PHP
- Homepage: https://arillo.github.io/silverstripe-metatags/
- Size: 79.1 KB
- Stars: 2
- Watchers: 8
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: Readme.md
- License: License.md
Awesome Lists containing this project
README
# Arillo\MetaTags
[![Latest Stable Version](https://poser.pugx.org/arillo/silverstripe-metatags/v/stable?format=flat)](https://packagist.org/packages/arillo/silverstripe-metatags)
[![Total Downloads](https://poser.pugx.org/arillo/silverstripe-metatags/downloads?format=flat)](https://packagist.org/packages/arillo/silverstripe-metatags)Better metatags for your SilverStripe Projects.
The module will add a `$MetaImage` to each page and a fallback `$MetaImage` to the `$SiteConfig` that will be used if no image is defined on a particular page (to avoid this behavior do not fill in the `$SiteConfig.MetaImage` in the CMS). It will automatically generate [OpenGraph](http://ogp.me/) and [Twitter](https://dev.twitter.com/cards/getting-started) meta tags based on pages `$MetaDescription`.
### Requirements
SilverStripe CMS ^4.0
For a SilverStripe 3.x compatible version of this module, please see the [1 branch, or 0.x release line](https://github.com/arillo/silverstripe-metatags/tree/1.x).
## Usage
Install with composer:
```bash
composer require arillo/silverstripe-metatags
```or clone the repo:
```bash
git clone [email protected]:arillo/silverstripe-metatags.git
```Configure the extension:
```yml
Arillo\MetaTags\MetaTagsExtension:
titles_by_pagetype:
Default: <% if $MetaTitle %>$MetaTitle<% else %>$Title<% end_if %> / $SiteConfig.Title # Define the default tag pattern. (Defaults to $Title)
HomePage: <% if $MetaTitle %>$MetaTitle<% else %>$Title<% end_if %> # Exception for the HomePage page-type
ProductsPage: $Item.Title # Pattern for a DataObject
```Include the template in your ``:
```html
$MetaTagsX
```
Be sure **not** to include `$MetaTags` in your ``, the module includes it in the default template. To customize the rendering of the metatags copy the template `MetaTagsX.ss` to your project theme.
Why the X? Because `$MetaTags` was taken by the SilverStripe default metatags =).
### Recommended
Move the `MetaDescription` field inside the Meta Tab:
```php