REC

Joe主题怎么使用OG标签?让qq分享有卡片?

Mr.路
1天前发布
AI摘要

本文指导在Joe主题中通过编辑`/usr/themes/Joe/public/include.php`文件添加OG标签,实现QQ分享时的卡片效果,需注意域名未被QQ拦截。

 大家想不想要在qq内发送网站有下面的效果?

VCG211342539567.webp


Screenshot_2025-07-27-18-03-15-10_9d26c6446fd7bb8.jpg



很简单的,跟着我操作。


找到include.php文件

文件目录:/usr/themes/Joe/public

mdljhfg9.png


编辑文件

mdljkede.png

在相关位置添加以下代码:

<!-- Open Graph 通用标签 -->
  <meta property="og:type" content="website">
  <meta property="og:url" content="<?php $this->options->siteUrl(); ?>">
  <meta property="og:title" content="<?php $this->archiveTitle('', '', true); ?><?php $this->options->title(); ?>">
  <meta property="og:description" content="<?php $this->options->description(); ?>">
  <meta property="og:site_name" content="<?php $this->options->title(); ?>">
  <meta property="og:image" content="https://pan.nmssb.cn/view.php/309d18bd505a8ac9a4ec279910eaf9dc.png">
  <meta property="og:image:width" content="300">
  <meta property="og:image:height" content="300">
  <meta property="og:image:type" content="image/png">

自己需要改的就是图片,图片中已经用箭头指出,图片尺寸就是300x300。


审查元素

mdljqmeq.png

打开浏览器f12审查,看到图片中标注的就算是成功了,如果你有cdn且设置了缓存请刷新全站缓存就能看到效果了。快去试试吧!


最后

请看这篇文章: Open Graph 通用标签:优化社交媒体分享的必备指南 了解更多og标签!

喜欢就支持一下吧
点赞 0 分享 收藏
评论 抢沙发
OωO
取消