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
This bundle enhances the handling of html <head>
section tags. It provides services to update head tags dynamically from your code.
Features
- Provide a nice api to set head tags like meta, title, base, link
- Provide additional json-ld schema 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
- Backport canonical url option from contao 4.13 for contao 4.9+
- Backport json-ld support for contao 4.9+
Usage
Setup
- Install with composer
- Update your database
-
Set following config variables (if you don't need the legacy implementation)
- 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 twitter:image) and twitter username (twitter:site) meta tags to you web page.
Add additional schema.org data
In your root page, you can activate to add additional structured data to you web page. Following schema.org types are available:
- @Organization
- @WebSite
- @WebPage
- @BreadcrumbList
Set json-ld in your templates
This bundle backports the methods of contao 4.12+ to contao 4.9+. So usage is the same as in the contao core.
Twig templates
PHP templates
Integration
Use head bundle api set in your code.
Set head content
To set base, title, meta and link tags, use the HtmlHeadTagManager
service:
Set json-ld schema data
From contao 4.12 you can use the JsonLdManager service from the core.
To set json-ld schema data, use the JsonLdManager
service:
Reader Config Contao sample
Legacy integration
Be sure, huh_head.use_contao_head
and/or huh_head.use_contao_variables
are not set to true.
Output $this->meta()
in your fe_page template ()
Make sure, that you remove (are outputted by $this->meta() if huh_head.use_contao_head
is not true):
The meta
function accepts currently one parameter that can contain service names (array) that should be skipped.
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:
Config reference
All versions of contao-head-bundle with dependencies
contao/core-bundle Version ^4.9
heimrichhannot/contao-utils-bundle Version ^2.219
psr/container Version ^1.0 || ^2.0
spatie/schema-org Version ^3.4
symfony/config Version ^4.4 || ^5.4
symfony/dependency-injection Version ^4.4 || ^5.4
symfony/http-kernel Version ^4.4 || ^5.4
symfony/service-contracts Version ^1.0 || ^2.0 || ^3.0
symfony/polyfill-php80 Version ^1.26