Set Open Graph Image

LNH

New member
Tham gia
19/5/23
Bài viết
29
Điểm tương tác
0
Điểm
1
This guide will help you to set your forum's open graph image. It will use the first image in your thread, whether linked directly or attached.

Open template: thread_view

Find:
Mã:
<xf:set var="$fpSnippet" value="{{ snippet($firstPost.message, 0, {'stripBbCode': true}) }}" />

Add below:
Mã:
<xf:if is="$thread.cover_image">
<xf:macro template="metadata_macros" name="metadata"
arg-description="{$fpSnippet}"
arg-shareUrl="{{ link('canonical:threads', $thread) }}"
arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}"
arg-imageUrl="{{ link({$thread.cover_image}) }}" />
<xf:else/>

Find:

Mã:
arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}" />

Add below:

Mã:
</xf:if>

Save.
 
Back
Bên trên