Skip to content

Commit

Permalink
[TASK] Prioritize preview image over other images
Browse files Browse the repository at this point in the history
Fixes: #2509
  • Loading branch information
peterkraume committed Jul 31, 2024
1 parent 6af9ae0 commit 624971f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Resources/Private/Partials/Detail/Opengraph.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,18 @@
<n:metaTag property="og:type" content="{settings.opengraph.type}" />
<n:metaTag property="og:url" content="" useCurrentDomain="1" />
<n:metaTag property="og:site_name" content="{settings.opengraph.site_name}" />
<f:if condition="{newsItem.falMedia}">
<f:variable name="ogImagePath" value="{f:uri.image(src:'{newsItem.falMedia.0.uid}', treatIdAsReference:1, maxWidth:'1200')}" />

<f:if condition="{newsItem.firstPreview}">
<f:then>
<f:variable name="ogImage" value="{newsItem.firstPreview}" />
</f:then>
<f:else if="{newsItem.falMedia}">
<f:variable name="ogImage" value="{newsItem.falMedia.0}" />
</f:else>
</f:if>

<f:if condition="ogImage">
<f:variable name="ogImagePath" value="{f:uri.image(src:'{ogImage.uid}', treatIdAsReference:1, maxWidth:'1200')}" />
<n:metaTag
property="og:image"
content="{ogImagePath}"
Expand Down

0 comments on commit 624971f

Please sign in to comment.