Rad*_*dek 8 html facebook-messenger
我在我的页面上使用 plyr 播放器。基本上页面上唯一的代码是这样的:
<div class="container">
<div id="player" data-plyr-provider="youtube" data-plyr-embed-id="123123132"></div>
</div>
<script src='https://data1.132231321.cz/124141/users/plyr/plyr.min.js'></script>
<script>
const player = new Plyr('#player', {});
// Expose player so it can be used from the console
window.player = player;
</script>
Run Code Online (Sandbox Code Playgroud)
一切正常。就在我通过 Messenger / whatsapp 将此类链接发送给某人时,他们会在预览中看到代码
我使用类似于 WordPress 的定制 CMS,我在 HTML 代码的帖子正文中添加了 plyr 脚本代码。
注意我无法在 html 中编辑或修改 head,只能在 html 正文中编辑 div class="container"。请参阅网址https://zz.zustatzdravy.cz/skryte/90-test-a.html。该网址将来可能会起作用。
我没有使用 WP,而是使用 WP 之类的东西。它是定制的,没有插件。我可以使用自定义 css
有什么办法可以在预览中隐藏代码吗?
我认为添加开放图/元描述会起作用。有关更多信息,请查看https://ogp.me/
在代码替换的所有实例{{TITLE TO SHOW IN PREVIEW}}和{{DESCRIPTION TO SHOW IN PREVIEW}}。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{{TITLE TO SHOW IN PREVIEW}}</title>
<meta name="title" content="{{TITLE TO SHOW IN PREVIEW}}">
<meta name="description" content="{{DESCRIPTION TO SHOW IN PREVIEW}}">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="video.other">
<meta property="og:title" content="{{TITLE TO SHOW IN PREVIEW}}">
<meta property="og:description" content="{{DESCRIPTION TO SHOW IN PREVIEW}}">
</head>
<body>
<div class="container">
<div id="player" data-plyr-provider="youtube" data-plyr-embed-id="123123132"></div>
</div>
<script src='https://data1.132231321.cz/124141/users/plyr/plyr.min.js'></script>
<script>
const player = new Plyr('#player', {});
// Expose player so it can be used from the console
window.player = player;
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
此外,我建议在og:description元标记下方添加以下内容。
<meta property="og:url" content="{{ URL OF PAGE }}" />
<meta property="og:image" content="{{ PREVIEW IMAGE }}">
Run Code Online (Sandbox Code Playgroud)
{{ URL OF PAGE }}在这种情况下是当前的 URL...所以如果 url 是https://example.com/thevideo那么内容og:url将是https://example.com/thevideo{{ PREVIEW IMAGE }}显示为预览的可选图像文件。这是域的完整网址,例如https://example.com/img/preview.jpg您可以使用Facebook 共享调试器工具进行测试。
您提到您正在使用 CMS。您可能需要找到一个插件来修改元标题标签。在 WP 中,您可以使用Yoast SEO 之类的东西。
基于只能更新正文的更新:看起来在您的特定情况下,CMS 已经添加了og:title和og:description。该og:title是网页标题和描述是页面上的文字片段。
使用开放图形标签实际上是您可以修改消息预览中显示的标题、描述和图像的唯一方法。因此,理想的情况取决于您使用的 CMS。
解决方案 1:将 javascript 移动到文件中。
以下代码未添加到说明中:
<script src='https://data1.azami.cz/124141/users/plyr/plyr.min.js'></script>
Run Code Online (Sandbox Code Playgroud)
因此,如果您可以使用const player = new player...代码创建另一个 javascript 文件,那么您还可以包含一个类似于以下的标签:
<script src='https://data1.azami.cz/124141/users/plyr/a_new_file_with_script.js'></script>
Run Code Online (Sandbox Code Playgroud)
使用解决方案 1. 描述现在应该是空的。
解决方案 2:在正文中添加描述
如果由于某种原因您无法在服务器上创建新文件,并且您真的可以修改正文,那么现在我唯一能想到的就是围绕它进行一些小技巧,它会添加新的描述,但可能不会从描述中删除 javascript 代码。除非这个新描述超过 300 个字符。
在包含视频的脚本标签之前,黑客会添加类似下面的代码。在查看网站时,它的描述将被隐藏,但在描述标签之前。
<div style="display: none">Here you can put a description of a video. Or a general description for the website. It will be displayed as the description when sharing via messenger. Maybe if you make this 300 characters or longer, then the script won't show up in the description. This text including this note is 300 characters.</div>
| 归档时间: |
|
| 查看次数: |
245 次 |
| 最近记录: |