Guide et astuce Définir l'image OpenGraph d'une discussion XenForo

Nativement XenForo diffuse l'image de votre logo lorsque vous partagez une discussion sur les réseaux sociaux comme Twitter ou Facebook.
Par exemple cette discussion https://xenforo.fr/threads/un-forum-pour-les-plateformes-autres-que-xenforo.104/#post-280 sera partagée ainsi :

Et quand bien même une photo aurait été publiée dans le premier message elle n'aurait pas servi lors de l'affichag de votre discussion sur un réseau social. Il y a une astuce pour contourner ce petit problème : dans le template thread_view :

1. Chercher
HTML:
<xf:macro template="metadata_macros" name="metadata"
    arg-description="{$fpSnippet}"
    arg-shareUrl="{{ link('canonical:threads', $thread) }}"
    arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}" />

2. Remplacer par
HTML:
<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="{$thread.cover_image}" />
    <xf:else/>
    <xf:macro template="metadata_macros" name="metadata"
        arg-description="{$fpSnippet}"
        arg-shareUrl="{{ link('canonical:threads', $thread) }}"
        arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}" />
</xf:if>

Et le résultat lorsque l'on partage une discussion comportant une photo :


source: [JoyFreak] Set Open Graph Image
 

XenForo FR

XenForo Bot
Membre du Staff
Il y a un module complémentaire pour cela maintenant :
 

Membres en ligne

Aucun membre en ligne actuellement.
Extras
Les tutoriels
en français
Collection de tutoriels exclusifs pour découvrir l'environnement XenForo.
Our translations
exclusives
French translation of official XenForo and XenAddons softwares.
The subscription
19.90 €
A premium account to access all our official resources.
Contribute to the development and sustainability of the forum with a donation to our PayPal account.
Haut