AMP

让您的页面可被发现

在某些情况下,您可能希望拥有同一页面的非 AMP 版本和 AMP 版本,例如,一篇新闻文章。考虑一下:如果 Google 搜索找到该页面的非 AMP 版本,它如何知道该页面有 AMP 版本?

为了解决这个问题,我们在非 AMP 页面上以 <head> 中的 <link> 标签的形式添加有关 AMP 页面的信息,反之亦然。

将以下内容添加到非 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">

继续阅读 –Google 搜索 AMP 页面指南中了解有关 Google 如何查找 AMP 页面的更多信息。

通过其他元数据与第三方平台集成

有时,第三方网站(嵌入您的 AMP 页面或包含指向该页面的链接)需要了解有关您的页面的更多信息,而不仅仅是它是一个 AMP 页面。平台可能询问有关您页面的问题包括“您是一篇新闻文章吗?”,“还是视频?”或“您有屏幕截图和简短描述吗?”。

这不仅与 AMP 页面相关,而且与所有网页相关。对于某些平台,此元数据是附加的,对于其他平台,这是必需的,这意味着如果您没有包含正确的元数据,它们将不会显示指向您内容的链接。确保为希望您的内容出现的平台包含正确的元数据。

针对大多数搜索引擎使用 Schema.org

Schema.org 提供开放的词汇表,用于向各种内容添加元数据。在 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 属性语法)。

访问这些资源以获取有关结构化数据的更多信息

其他元数据,用于更多平台

前往 Web Fundamentals 上的社交发现指南,了解有关准备您的内容以进行发现和分发的所有其他不同方法。