nepada/meta-control
最新稳定版本:v1.6.0
Composer 安装命令:
composer require nepada/meta-control
包简介
Nette control for managing meta data in HTML header.
关键字:
README 文档
README
Installation
Via Composer:
$ composer require nepada/meta-control
Usage
First register the control factory in your config and optionally set up default metadata:
services: - implement: Nepada\MetaControl\MetaControlFactory setup: - setCharset('utf-8') - setAuthor('Jon Doe')
Use the control factory in your presenter:
protected function createComponentMeta(): Nepada\MetaControl\MetaControl { $control = $this->metaControlFactory->create(); $control->setDescription('Lorem ipsum'); return $control; }
And render it in your Latte template:
<html> <head> {control meta} </head> <body> ... </body> </html>
Overview of supported meta tags
Charset:
// <meta charset="utf-8"> $control->setCharset('utf-8'); $control->getCharset(); // 'utf-8'
Document metadata:
// <meta name="author" content="John Doe"> $control->setMetadata('author', 'Jon Doe'); $control->getMetadata('author'); // 'Jon Doe'
Document properties:
// <meta property="og:title" content="Foo title"> $control->setProperty('og:title', 'Foo title'); $control->getProperty('og:title'); // 'Foo title'
Pragma directives:
// <meta http-equiv="content-type" content="text/html; charset=UTF-8"> $control->setPragma('content-type', 'text/html; charset=UTF-8'); $control->getPragma('content-type'); // 'text/html; charset=UTF-8'
Shorthands for standard metadata
Author:
// <meta name="author" content="John Doe"> $control->setAuthor('Jon Doe'); $control->getAuthor(); // 'Jon Doe'
Description:
// <meta name="description" content="Lorem ipsum"> $control->setDescription('Lorem ipsum'); $control->getDescription(); // 'Lorem ipsum'
Keywords:
// <meta name="keywords" content="foo, bar, baz"> $control->setKeywords('foo', 'bar'); $control->addKeyword('baz'); $control->getKeywords(); // ['foo', 'bar', 'baz']
Robots:
// <meta name="robots" content="noindex, nofollow"> $control->setRobots('noindex, nofollow'); $control->getRobots(); // 'noindex, nofollow'
统计信息
- 总下载量: 3.61k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2017-09-16