我無法讓 Facebook 開放式圖形抓取工具查看我的頁面或識別頁面上的元標記。我們的一些頁面可以作業(例如書籍產品頁面),但大多數頁面在除錯器中不顯示任何影像或正確的標題資訊。主頁是我對讓 Facebook 識別出特別感興趣的主頁,但還有許多其他主頁不起作用。我們所有的頁面都在此處的 facebook 刮板中顯示了 206 回應代碼:
從
由于我通常在刮刀除錯器上測驗的其他頁面上看到回應 200,因此我還創建了一個小型版本的主頁,僅使用開放圖元標記作為測驗。該頁面可以在這里看到:
Even this small page gives me a response of 206 from the debugger. I think the 206 is probably not related the problem. Facebook support pages say it is OK, but it seems odd that such a small page would give a partial response... so maybe it is part of the problem.
One other thing that was sort of interesting: I tested one page on our site that has no og: tags, and it worked the first time I tried it in the scraper, showing an image and lots of constructed og tags. Plus, it showed me lots of info when I clicked on 'What the scraper sees' link. But subsequent tests of the same page (which hasn't changed at all) in the debugger have been empty images, and a blank page in what the scraper sees. This was that page: https://press.uchicago.edu/books/freeEbook.html
uj5u.com熱心網友回復:
顯然這是快取控制。我們將其定義為:“快取控制:無快取,無存盤,必須重新驗證,max-age=0”。但我將其更改為“Cache-Control: no-cache”,Facebook 突然可以看到該頁面。
Facebook 必須需要存盤頁面的副本,因此無存盤設定可以防止這種情況。
以下是有關設定的更多資訊:
“無快取”和“無存盤”
“no-cache”表示回傳的回應不能用于滿足對同一 URL 的后續請求,而無需先與服務器檢查回應是否已更改。因此,如果存在正確的驗證令牌 (ETag),則 no-cache 會引發往返以驗證快取的回應,但如果資源未更改,則可以消除下載。
相比之下,“無商店”要簡單得多。它只是禁止瀏覽器和所有中間快取存盤任何版本的回傳回應——例如,包含私人個人或銀行資料的回應。每次用戶請求此資產時,都會向服務器發送請求并下載完整回應。
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#directives
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/355698.html
標籤:html facebook facebook-opengraph
