arillo/silverstripe-metatags
最新稳定版本:3.0.2
Composer 安装命令:
composer require arillo/silverstripe-metatags
包简介
Metatags for SilverStripe
README 文档
README
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 and Twitter meta tags based on pages $MetaDescription.
Requirements
| CMS version | Branch / version |
|---|---|
| SilverStripe CMS ^6 | master (3.x-dev) — you are here |
| SilverStripe CMS ^4 || ^5 | 2.x |
| SilverStripe CMS ^3 | 1.x |
PHP ^8.3 required for the SS6 master line.
Usage
Install with composer:
composer require arillo/silverstripe-metatags
or clone the repo:
git clone git@github.com:arillo/silverstripe-metatags.git
Configure the extension:
Arillo\MetaTags\MetaTagsExtension: titles_by_pagetype: Default: <% if $MetaTitle %>$MetaTitle<% else %>$Title<% end_if %> / $SiteConfig.Title # Define the default <title> 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 <head>:
<head> $MetaTagsX </head>
Be sure not to include $MetaTags in your <head>, 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 use Arillo\MetaTags\MetaTagsExtension; class Page extends SiteTree { public function getCMSFields() { // move meta fields return MetaTagsExtension::prepare_cms_fields(parent::getCMSFields()); } }
统计信息
- 总下载量: 888
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-02-24