Metadata
11 April 2022 | | Documentation v2
Page level metadata
You can customise the site metadata for every individual piece of content, using the fields from Meta Tags section of the content submission form:
- Title: Used to set the <title> tag for the page, which is visible in the top bar of some browsers.
- Description: Used to display the page description in search engine results, limit it to 160 characters or they may crop it.
- SEO: An SEO-friendly string of text that will be appended to the URLs.
Site level metadata
The meta tags of your site are set in the <head> section of layout.html. The default site metadata properties, which are displayed on your home page or when otherwise unspecified, are mainly set from the Tuskfish preferences:
- metaTitle: Site name preference.
- metaDescription: Site description preference.
- metaAuthor: Site author / publisher preference.
- dcterms.rights: Site copyright preference.
Overriding metadata
Website- and page-level metadata are handled by the TfMetadata class. This class is instantiated via tfHeader.php as the variable $tfMetadata, which is available in every page load.
You can customise these properties for an individual page simply by overriding the default value in $tfMetadata. At the bottom of every user-facing Tuskfish script you will find a commented-out list of metadata properties. If you want to change one, just uncomment the relevant line and set the value, or you can set it in your controller logic:
/**
* Override page template and metadata here (otherwise default site metadata will display).
*/
// $tfMetadata->setTitle('');
// $tfMetadata->setDescription('');
// $tfMetadata->setAuthor('');
// $tfMetadata->setCopyright('');
// $tfMetadata->setGenerator('');
// $tfMetadata->setSeo('');
// $tfMetadata->setRobots('');Copyright, all rights reserved.