[JoyFreak] Set Open Graph Image

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

没有下载权限
XF 兼容性
  1. 2.2.x
摘要
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:
代码:
<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:
代码:
arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}" />


Add below:
代码:
</xf:if>


Save.

Example at Gaming Forum
作者
axtona
浏览
460
首次发布
上次更新
评分 0.00 星 0 个评分
链接失效了吗? 发送消息 给 NP 团队,我们会尽快为您处理!
支持开发者 如果您对测试满意或项目已成功盈利,可点击「更多信息」按钮,通过购买来支持开发者!

来自 axtona 的更多资源

[XFSkins] Thread Rating A
Topic Rating plugin adds a clean and easy-to-understand star rating system to XenForo topics
资产管理者 A
资产管理器为XenForo管理员提供了一种可视化和组织化的管理图片的方式
[FF] Login Spaminator Admin Area Logs A
Simple mod that allows you to browse the Spaminator logs from inside the admin area

相似的资源

[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.
返回
顶部