XF 2.3 When using ARTICLE threads, the og:image is missing or incorrect

drastic

Well-known member
Does anyone know how we can set the og:image to be the first image uploaded to our article threads?

It's hard to promote our threads/articles on social media when the og:image is missing, or it's always our default image.

Would be cool if article threads (and all threads) allowed us to designate a featured image.

It would def help us promote our communities on other platforms.

If anyone knows how to do this, please jump in the convo.

Thx
 
Just had another look at this. You could try this for template edit or mod

Find in temple thread_view

Code:
xf:macro id="metadata_macros::metadata"
    arg-description="{$fpSnippet}"
    arg-shareUrl="{{ link('canonical:threads', $thread) }}"
    arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}" />

Replace with

Code:
<xf:if is="$thread.cover_image">
    <xf:macro id="metadata_macros::metadata"
        arg-description="{$fpSnippet}"
        arg-shareUrl="{{ link('canonical:threads', $thread) }}"
        arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}"
        arg-imageUrl="{$thread.cover_image}" />
<xf:else/>
    <xf:macro id="metadata_macros::metadata"
        arg-description="{$fpSnippet}"
        arg-shareUrl="{{ link('canonical:threads', $thread) }}"
        arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}" />
</xf:if>
 
Back
Top Bottom