The way to set tags up to v8 is an one-way API. You can add a meta tag but not programatically remove or overwrite it.
A current proposal for a new API has been merged into core in early Nov. 2017 and raised some concern afterwards.
The issues addressed now are that we only cover 80% of the standard (even though solving 99% of the problems integrators have with it) so before diving into the topic again I'd like to propose the following solution:
Context Aware Meta Tags
Each meta tag will be flagged as one of 3 possible states:
- Static Meta Tags
- Content Meta Tags
- Special Meta Tags
In order to understand the reasoning we need to try to understand the problems we try to solve:
An integrator sets a variety of meta tags during the templating process.
just to name a few.
If these are set at templating level these will always get rendered.
The tricky part is when an extension has a detail view, we'll use EXT:news as an example here.
EXT:news might add its one og:image as well as its own og:title and an author.
These meta tags now get rendered multiple times with various levels of impact.
While an additional author might not be a problem, multiple og:image tags indeed are.
Workaround like telling the editor not to upload an og:image into the pages properties are shaky at best (and most of the time pointless because the integrator is smart and provides a fallback.
Ideally EXT:news would instruct TYPO3 to remove all Content Meta Tags and set its own.
In our case a call to
$pageRenderer->removeContentMetaTags() would remove:
viewport have been kept. This is because there is no reason to overwrite these programatically.
EXT:news can now add its meta tags
In a special case our integrator what's to set
noindex, nofollow and thus has to call
$pageRenderer->removeSpecialMetaTags() in order to do so.
- It solves real-world problems rather than addressing academic issues
- The API is concise and offers little room for discussion
- The API is simply and easy to use
Remarks and notes
Topic Initiator: Mathias Schreiber
Topic Mentor: Benjamin Kott