Skip to content
TYPO3 extension to ease handling of meta tags
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Classes
Tests/Unit
.gitattributes
.gitignore
.travis.yml
LICENSE
Readme.md
composer.json
ext_emconf.php
ext_localconf.php

Readme.md

meta-tag Build Status

TYPO3 extension allowing to write your meta-tags in Fluid. Syntax is a close as possible to the HTML <meta> tag. Uses a singleton that behaves in the same way as the upcoming metatag API in TYPO3 v9. Ships with one level of override.

Installation

Via composer

composer require undkonsorten/meta-tags

or from Github

Configuration

No configuration is needed, there‘s no TypoScript to include.

Usage

To use the view helper in your Fluid templates you have to import the namespace, e.g.:

<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
        xmlns:m="http://typo3.org/ns/Undkonsorten/MetaTag/ViewHelpers"
        data-namespace-typo3-fluid="true">

or

{namespace m=Undkonsorten\MetaTag\ViewHelpers}

Then you can use the meta view helper in any of the following forms:

<!--Tag style-->
<m:meta http-equiv="content-type" content="{settings.contentType}" />
<!--Inline style-->
{m:meta(property:'og:description',content:description)}
<!--You can omit content attribute and use tag content instead-->
<m:meta property="og:image"><f:uri.image image="{image}" width="800" height="600" absolute="1" /></m:meta>
<!--The same works for inline syntax-->
{author.fullName -> m:meta(name:'author')}

If the content is empty (i.e. only white-space characters) no meta tag is added. There‘s no need to wrap each of your meta tags in an if construct just to get rid of the empty ones.

Overriding

If for a requested meta tag there‘s a collision with an existing meta tag (same property / name / http-equiv value) then the existing one will be kept and the new one will be discarded. To change this behavior you can set override="1". Then any existing meta tag of the same type will be overridden.

That means you have a two-level hierarchy that works regardless of processing order at run time. Just define your "global" meta tag with values e.g. from pages record without override but set that flag for your more specific ones, e.g. coming from extension show actions.

You can’t perform that action at this time.