nepada/meta-control 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nepada/meta-control

最新稳定版本:v1.6.0

Composer 安装命令:

composer require nepada/meta-control

包简介

Nette control for managing meta data in HTML header.

README 文档

README

Build Status Coverage Status Downloads this Month Latest stable

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

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2017-09-16