Hallo zusammen.
Ich habe einen Contentblock mit einem Video. Das Video soll mit rich snippets angereichert werden.
Mein Fluid im CB ist
<div class="video-background">
<f:if condition="{data.video.0}">
<f:if condition="{data.video.0}">
<f:switch expression="{file.type}">
<f:case value="4">
<f:media file="{data.video.0}" additionalConfig="{loop: '1', autoplay: '1', muted: '1', playsinline: '1', controls: '0', poster: '{f:uri.image(image: data.thumbnail.0)}'}" />
</f:case>
<f:defaultCase>
<f:media file="{data.video.0}" additionalConfig="{
loop: '1',
autoplay: '1',
muted: '1',
playsinline: '1',
controls: '0',
poster: '{f:uri.image(image: data.thumbnail.0, absolute: 1)}'
}" />
</f:defaultCase>
</f:switch>
</f:if>
</f:if>
</div>
Für die Rich Snippets habe ich, mithilfe der PhpStorm AI und Chat GPT folgendes in den Header eingetragen (in der frontend.html des CBs)
<f:section name="Header">
<f:if condition="{data.video.0}">
<f:variable name="thumbUrl">{f:uri.image(image: data.thumbnail.0, absolute: 1)}</f:variable>
<f:variable name="contentUrl">{data.video.0.publicUrl}</f:variable>
<f:variable name="embedUrl">{f:uri.page(absolute: 1)}</f:variable>
<f:variable name="name">{data.mainheader}</f:variable>
<f:variable name="description">{f:format.stripTags(value: data.teaser)}</f:variable>
<f:variable name="uploadDate">{f:format.date(date: data.crdate, format: 'Y-m-d')}</f:variable>
<f:variable name="duration">PT0M30S</f:variable>
<f:asset.script identifier="videoobject-{data.uid}" type="application/ld+json" priority="true" parse="true">
{f:format.json(value: {
'@context': 'https://schema.org',
'@type': 'VideoObject',
name: name,
description: description,
thumbnailUrl: thumbUrl,
uploadDate: uploadDate,
contentUrl: contentUrl,
embedUrl: embedUrl,
duration: duration
}) -> f:format.raw()}
</f:asset.script>
</f:if>
</f:section>
Die Ausgabe im HTML ist Folgende.
<script type="application/ld+json" parse="true">
{f:format.json(value: {
'@context': 'https://schema.org',
'@type': 'VideoObject',
name: name,
description: description,
thumbnailUrl: thumbUrl,
uploadDate: uploadDate,
contentUrl: contentUrl,
embedUrl: embedUrl,
duration: duration
}) -> f:format.raw()}
</script>
Das fluid wird also nicht im HTML geparst. Zusätzlich wird "VideoObject" im rich snippet tester nicht erkannt, stattdessen gibt es den Fehler
"}" oder Name des Objektmitglieds fehlt.
Ich glaube, dass ich auf der falschen Spur bin, mit dem was ich hier versuche. Kann mir jemand auf die richtige Fährte helfen?
Besten Dank und liebe Grüße Nicole