Download the PHP package heimrichhannot/contao-head-bundle without Composer
On this page you can find all versions of the php package heimrichhannot/contao-head-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download heimrichhannot/contao-head-bundle
More information about heimrichhannot/contao-head-bundle
Files in heimrichhannot/contao-head-bundle
Package contao-head-bundle
Short Description This module contains enhancements for the contao frontend page region.
License LGPL-3.0-or-later
Informations about the package contao-head-bundle
Contao Head bundle
Enhance your website's SEO and social media presence with more meta- and structured data.
Features
- Set open graph tags like og:title, og:description, og:url and og:image
- Provide a nice api to set head tags like meta, title, base, link
- Provide additional schema.org json-ld data
- Sets important meta tags like og:title, og:description, og:url and twitter:card out of the box
- Allow setting open graph and twitter fallback image on root page
- Allow setting twitter author per root page
Usage
Setup
- Install with composer
- Update your database
- Optional: Set fallback image and twitter author in root page(s)
Add additional meta tags
In your root page, you can activate to add fallback image (og:image) and X/Twitter username (twitter:site) meta tags to you web page.
Add additional schema.org data
In your root page, you can activate additional structured data for your web page. Following schema.org types are available:
- @Organization
- @WebSite
Add (meta-)tags from template (twig)
The bundle provides Twig functions to add head tags from Twig templates:
| Function | Description |
|---|---|
add_head_tag(name, value) |
Add all kinds of head tag. Meta tag names must be prefixed with meta_, for example meta_description or meta_og:title. |
add_head_meta_tag(name, value) |
Shorthand for meta tags. The function adds the meta_ prefix automatically. |
add_head_tags(array) |
Add multiple tags at once. Pass as key => value or a AbstractHeadTag object. Meta tags must be prefixed with meta when passed as key. |
get_head_news_tags(model, figure) |
Create an array of tags for news models. The function automatically adds og:title, og:description, og:url and og:image tags. Pass a figure to override default news article image. |
The value argument can be a string, null or a Contao Figure. If a Figure is passed, its image source is used as the tag content.
Integration
Use head bundle api set in your code.
Set head content
To set base, title, meta and link tags, use the HtmlHeadTagManager service:
Developers
Backend field
Get tag options for a select field. If you want to define options by your own, prepend meta tag options with meta_.
Example how to evaluate field values:
All versions of contao-head-bundle with dependencies
contao/core-bundle Version ^5.3
heimrichhannot/contao-utils-bundle Version ^3.0
psr/container Version ^1.0 || ^2.0
spatie/schema-org Version ^3.4
symfony/config Version ^6.4 || ^7.0
symfony/dependency-injection Version ^6.4 || ^7.0
symfony/http-kernel Version ^6.4 || ^7.0
symfony/service-contracts Version ^1.0 || ^2.0 || ^3.0