如何有效評估 Accelerated Mobile Pages 的相關問題
2016 年 9 月 19 日,星期一
由於只有有效的 AMP 網頁才能顯示在 Google 搜尋中,因此在透過 Accelerated Mobile Pages 為網站製作 AMP 網頁後,請務必定期留意網頁的驗證狀態。
實作 AMP 時,網頁有時候會有錯誤,導致 Google 搜尋無法為網頁建立索引。網頁上出現的某些警告可能代表現有的實作方式不盡理想,或者是某些內容以後可能會出錯。
Google Search Console 這項工具可讓您查看 Google 發現含有錯誤的 AMP 網頁。瞭解哪些網址發生問題後,您可以使用下列幾項實用工具,透過更輕鬆的方式進一步檢查驗證錯誤。
如何使用開發人員工具進行驗證:
- 在瀏覽器中開啟您的 AMP 網頁
-
將
#development=1
附加至網址,例如 https://localhost:8000/released.amp.html#development=1
。
-
開啟 Chrome 開發人員工具主控台,檢查是否有驗證錯誤。
Play 管理中心錯誤看起來是這樣子的:
AMP 瀏覽器擴充功能
您可以使用 AMP 瀏覽器擴充功能 (適用於 Chrome 和 Opera) 快速識別無效的 AMP 網頁並進行偵錯。瀏覽網站時,擴充功能會評估您造訪的個別 AMP 網頁,並判斷該網頁是否有效。下表列出的是依據 AMP 標記的有效性,擴充功能可能會顯示的各種圖示。
|
如果 AMP 網頁內含錯誤,擴充功能圖示會顯示為紅色,並顯示出現的錯誤數量。 |
|
如果 AMP 網頁沒有錯誤,圖示會顯示為綠色,並顯示警告的數量 (如果有的話)。 |
|
如果該網頁不是 AMP 網頁,但指定提供 AMP 版本,圖示會顯示為藍色連結圖示,按一下擴充功能即可將瀏覽器重新導向至 AMP 版本網頁。 |
使用擴充功能時,只要點選擴充功能圖示,即可查看網頁的錯誤或警告內容。這項功能會逐一列出造成問題的原始碼在哪一行、哪一欄,以及錯誤說明訊息。如果有更詳盡的問題說明,您還會看到「瞭解詳情」連結,讓您直接連到 ampproject.org 的相關說明頁面。
AMP Web Validator
AMP Web Validator (網址:validator.ampproject.org) 提供簡單的網頁使用者介面,可讓您測試 AMP 網頁是否有效。
如要使用該工具,請輸入 AMP 網址,或複製/貼上您的原始碼,網路驗證工具隨即會在其中顯示錯誤訊息。您可以直接在網路驗證工具中進行編輯,藉此觸發重新驗證程序,瞭解您建議的調整是否能解決問題。
您最喜歡使用什麼方式檢查您 AMP 網頁的狀態?如果您有任何意見,歡迎在下方留言分享,或者前往 Google 網站管理員 Google+ 專頁告訴我們。如有任何問題或需要協助,您依然可以隨時在網站管理員說明論壇中提問。
發文者:AMP 社群經理 Tomo Taylor
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
[null,null,[],[[["Google Search Console helps you identify AMP pages with validation errors, which can prevent indexing by Google Search."],["You can use browser Developer Tools, AMP Browser Extensions (for Chrome and Opera), or the AMP Web Validator to check AMP page validation status and debug errors."],["Validation errors in AMP pages prevent them from being indexed by Google Search; warnings indicate elements that are not best practice or may become errors in the future."],["AMP Browser Extensions offer a visual indication of page validity through color-coded icons, displaying error counts or warning counts."],["The AMP Web Validator allows you to input an AMP URL or source code to identify errors, make edits, and see if the changes resolve the issues."]]],["To ensure AMP pages show on Google Search, validate them for errors. Use Google Search Console to identify problematic URLs. For detailed checks, utilize browser developer tools by adding `#development=1` to the URL. AMP browser extensions quickly flag errors and warnings with color-coded icons. The AMP Web Validator ([validator.ampproject.org](https://validator.ampproject.org/)) allows URL entry or code pasting for validation and on-page editing. Issues display with line, column, and error descriptions.\n"]]