讓您的網頁更容易被搜尋到
重要提示:此文件不適用於您目前選擇的格式廣告!
在某些情況下,您可能希望同一個網頁同時擁有非 AMP 和 AMP 版本,例如一篇新聞報導。請思考:如果 Google 搜尋找到該網頁的非 AMP 版本,它如何知道還有 AMP 版本?
使用 <link> 連結網頁
為了解決這個問題,我們在非 AMP 網頁中加入關於 AMP 網頁的資訊,反之亦然,形式是在 <head>
中使用 <link>
標籤。
將以下內容加入到非 AMP 網頁
<link rel="amphtml" href="https://www.example.com/url/to/amp/document.html">
並將此內容加入到 AMP 網頁
<link rel="canonical" href="https://www.example.com/url/to/full/document.html">
如果我只有一個網頁怎麼辦?
如果您只有一個網頁,且該網頁是 AMP 網頁,您仍然必須加入標準連結到它,而該連結將會指向自身
<link rel="canonical" href="https://www.example.com/url/to/amp/document.html">
透過額外metadata與第三方平台整合
有時第三方網站(嵌入您的 AMP 網頁或包含其連結)除了知道它是 AMP 網頁之外,還需要了解更多關於您的網頁的資訊。平台可能會詢問關於您的網頁的問題,例如「您是新聞報導嗎?」「還是影片?」,或「您有螢幕截圖和簡短描述嗎?」。
這不僅僅與 AMP 網頁相關,而是與所有網頁相關。對於某些平台,此 metadata 是額外的,對於其他平台,這是必要條件,表示如果您沒有加入正確的 metadata,它們將不會顯示您內容的連結。請確保為您希望內容顯示的平台加入正確的 metadata。
為大多數搜尋引擎使用 Schema.org
Schema.org 提供開放詞彙來為各種事物加入 metadata。在 AMP 的情況下,在上下文中合理的屬性包括特定內容類型(即「新聞報導」)、標題、發布日期和相關的預覽圖片。
範例
<script type="application/ld+json"> { "@context": "http://schema.org", "@type": "NewsArticle", "mainEntityOfPage": "http://cdn.ampproject.org/article-metadata.html", "headline": "Lorem Ipsum", "datePublished": "1907-05-05T12:02:41Z", "dateModified": "1907-05-05T12:02:41Z", "description": "The Catiline Orations continue to beguile engineers and designers alike -- but can it stand the test of time?", "author": { "@type": "Person", "name": "Jordan M Adler" }, "publisher": { "@type": "Organization", "name": "Google", "logo": { "@type": "ImageObject", "url": "http://cdn.ampproject.org/logo.jpg", "width": 600, "height": 60 } }, "image": { "@type": "ImageObject", "url": "http://cdn.ampproject.org/leader.jpg", "height": 2000, "width": 800 } } </script>
更多範例可以在 ampproject 範例資料夾中找到,包括替代的 HTML 屬性語法)。
- 學習如何建構您的內容,使其顯示在 Google 搜尋的複合式搜尋結果中(例如,熱門新聞輪播、食譜卡等)。
- 使用 Google 結構化資料測試工具測試您的結構化資料。
更多平台的其他 metadata
前往 Web Fundamentals 的社群探索指南,以了解所有其他準備您的內容以進行探索和發布的不同方法。