[JoyFreak] Set Open Graph Image

[JoyFreak] Set Open Graph Image 2022-11-24

Keine Berechtigung zum Herunterladen
XF-Kompatibilität
  1. 2.2.x
Kurzbeschreibung
A step-by-step guide to setting your forum's open graph image using the first thread image. Add a conditional macro for cover images and include canonical URLs in Open Graph metadata for better SEO. Example provided for Gaming Forum.
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:
Code:
<xf:set var="$fpSnippet" value="{{ snippet($firstPost.message, 0, {'stripBbCode': true}) }}" />


Add below:

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/>


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


Add below:
Code:
</xf:if>


Save.

Example at Gaming Forum
Autor
axtona
Ansichten
460
Erste Veröffentlichung
Letzte Aktualisierung
Bewertungen 0.00 Sterne 0 Bewertungen
Link defekt? Nachricht senden an das NP-Team – wir helfen dir schnell!
Unterstütze den Entwickler Wenn du mit dem Test zufrieden bist oder mit deinem Projekt erfolgreich Geld verdient hast, klicke auf den Button Mehr Informationen, um den Entwickler durch einen Kauf zu unterstützen.

Weitere Ressourcen von axtona

Sorcererprozoom A
Platz PHP und alle Art von HTML, CSS und JavaScript-Code direkt in dein Inhalt!
Cache-Cleaner-PRO A
Cache-Cleaner kann auch automatisch den Joomla! Cache nach der Speicherung eines Artikels oder anderer Inhalte bereinigen.
Auto Schließen + Thread-Bemerkung A
Auto Close Thread Notice hilft, ältere Diskussionen sauber zu halten ohne überraschende Nachrichten für deine Mitglieder.

Ähnliche Ressourcen

[cXF] Node icons with image A
Would you like to change your default Font Awesome node icons with image like this?
Default image for trending threads H
modification trending threads without image will have an image by default.
Zurück
Oben