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

来自 axtona 的更多资源

Persona - 个性化你的论坛身份 A
Persona为论坛上的每一个成员提供了工具,让他们能够打造自己的存在感。
XenForo媒体图库/XFMG A
XenForo媒体图库是官方的XenForo扩展程序,允许您为您的XF2添加一个相册
Relevio.ai A
Relevio.ai 1.0.0
这是一个针对XenForo的Relevio插件,它是一个独特的上下文感知、规则驱动的内容管理引擎

相似的资源

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