Facebook Open Graph共享调试器无法很好地阅读我的代码 [英] Facebook Open Graph Sharing Debugger not reading my code well
问题描述
当我在打开的图形调试器上检查我的网址并再次单击scrape时
When I check my url on open graph debugger and click on scrape again
https://developers.facebook.com/tools/debug/sharing/?q=https%3A%2F%2Fwww.tvsrbija.online%2Findex.php
我收到一个奇怪的错误
我们的页面的正文而不是头部带有meta标记.这可能是因为您的HTML格式不正确,并且它们在分析树中的位置降低了.请修正此问题以使标签可用.
our page has meta tags in the body instead of the head. This may be because your HTML was malformed and they fell lower in the parse tree. Please fix this in order for the tags to be usable.
但是,当您查看源代码时,我的代码中的所有内容都很好.我尝试抓取空白的index.php文件,当我这样做时,这就是Facebook看到的内容
But everything with my code is fine when you look into the source. I tried scraping blank index.php file, and when i do, here is what Facebook sees
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head></html>
但是没有这样的代码,如果我转到我网站的空白index.php页面并检查源文件是否为空白...
But there is no such code, If i go to blank index.php page of my site and check the source it is blank...
但是,当我使用index.html而不是index.php时,Facebook看不到任何代码,应该使用空的index.php
BUT, when i use index.html instead of index.php Facebook sees no code as it should with an empty index.php
问题是我的脚本是php而不是html,所以我无法使用html扩展名来解决问题.我什至尝试将.php扩展名重写为html,因为我认为也许Facebook处理方式有所不同,但没有运气.我也尝试将Cloudflare暂停几天,然后做同样的事情...
Problem is my script is php and not html so i can not use html extension to fix problem. I even tried rewriting .php extension to html because I thought maybe Facebook handles it differently but with no luck. Also I try pausing Cloudflare for couple of days and the same thing...
那会是什么?
Here you can see how Facebook sees my source code https://developers.facebook.com/tools/debug/echo/?q=https%3A%2F%2Fwww.tvsrbija.online%2Findex.php
推荐答案
尝试将编码更改为UTF8,而不要使用繁荣,而不仅仅是utf8.对于许多开发人员来说,这一直是令人头疼的问题,因为utf8在文件指示文件为utf8之前添加了信息
Try changing encoding to UTF8 without boom instead of just utf8. This has been a headache for many developers because utf8 adds info before file indicating file is utf8
这篇关于Facebook Open Graph共享调试器无法很好地阅读我的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!