有時候瀏覽器自動修復一些HTML的正確渲染頁面,諸如此類結束標籤,添加缺少的語義標記等,但在機器人上有效的HTML更苛刻一點。
讓我們來看看您共享該頁面源頭的前12行。這是瀏覽器接收:
<!doctype html>
<!--[if IE 8]><html
class="ie8" lang="fr-FR" prefix="og: http://ogp.me/ns#"> <![endif]-->
<!--[if IE 9]><html
class="ie9" lang="fr-FR" prefix="og: http://ogp.me/ns#"> <![endif]-->
<!--[if gt IE 8]><!--><html
lang="fr-FR" prefix="og: http://ogp.me/ns#"> <!--<![endif]--><head><link
rel="stylesheet" type="text/css" href="http://cdn.vedettequebec.com/wp-content/cache/minify/ef20c.css?x41125" media="all" /><meta
charset="UTF-8" /><meta
name="viewport" content="width=device-width, initial-scale=1.0"><link
rel="pingback" href="http://vedettequebec.com/xmlrpc.php" /><meta
name="author" content="BadassB"><link
正如你所看到的,屬性包裹起來到下一行,這是一種有效的,大多數瀏覽器會處理這一點,但看起來像Facebook的刮板修剪\n
字符和解釋代碼,如下所示:
<!doctype html><!--[if IE 8]><htmlclass="ie8" lang="fr-FR" prefix="og: http://ogp.me/ns#"> <![endif]--><!--[if IE 9]><htmlclass="ie9" lang="fr-FR" prefix="og: http://ogp.me/ns#"> <![endif]--><!--[if gt IE 8]><!--><htmllang="fr-FR" prefix="og: http://ogp.me/ns#"> <!--<![endif]--><head><linkrel="stylesheet" type="text/css" href="http://cdn.vedettequebec.com/wp-content/cache/minify/ef20c.css?x41125" media="all" /><metacharset="UTF-8" /><metaname="viewport" content="width=device-width, initial-scale=1.0"><linkrel="pingback" href="http://vedettequebec.com/xmlrpc.php" /><metaname="author" content="BadassB"><link
您現在看到該問題了嗎?由於標籤名稱旁邊添加的屬性會導致代碼被破壞,造成大量「未封閉的標籤」。例如,檢查<html>
標籤轉換爲<htmlclass>
,並且其結束標籤將爲</html>
,因爲標籤名稱後沒有任何內容,使該標籤未關閉。
禁用任何可能損害您的HTML的插件,像HTML縮小器一樣的插件。如果有像「將屬性換行到新行」那樣檢查設置。
我確實看到了你所指的問題,但我不明白爲什麼要這樣做......最後,確實是一個微型插件的問題。 – CharleyB0y