测试AMP页面时看不到预览按钮

时间:2018-09-29 10:20:45

标签: amp-html

我创建了一个示例文章来测试AMP page

结构化的AMP代码

<script type="application/ld+json">
        {
        "@context": "http://schema.org",
        "@type": "NewsArticle",
        "mainEntityOfPage": {
        "@type": "WebPage",
        "@id": "https://www.c-sharpcorner.com/article/creating-web-api-using-code-first-approach-in-entity-framework/"
        },
        "headline": "Creating Web API Using Code-First Approach In Entity Framework",
        "image": {
        "@type": "ImageObject",
        "url": "https://jitangupta.github.io/amp/helpful-images/aritcle-entity-framework.gif",
        "height": 800,
        "width": 800
        },
        "datePublished": "2017-05-16T08:00:00+08:00",
        "dateModified": "2015-05-16T09:20:00+08:00",
        "author": {
        "@type": "Person",
        "name": "Jitan Gupta"
        },
        "publisher": {
        "@type": "Organization",
        "name": "csharpcorner",
        "logo": {
        "@type": "ImageObject",
        "url": "https://csharpcorner-mindcrackerinc.netdna-ssl.com/App_Themes/CSharp/Images/SiteLogo.png",
        "width": 600,
        "height": 60
        }
        },
        "description": "In this article, we will create a database with a foreign key constraint (one to many relationship), using Code First technique in an Entity Framework, seed some sample data and return the data, using the Web API."
        }
</script>

但是在Google Structured Data Test上进行测试

Screenshot

我无法查看预览按钮以查看实时结果。

GitHub存储库: https://github.com/jitangupta/amp/

2 个答案:

答案 0 :(得分:0)

我认为问题是您的页面不是有效的AMP页面。 您可以使用验证器对其进行验证:https://validator.ampproject.org

要预览您的页面,您应该使用以下页面:https://search.google.com/test/amp 当您的页面有效时,将显示此预览选项。

答案 1 :(得分:0)

看起来,根据“ @type”属性,会有不同的输出。 使用“ @type”:“ Recipe”,您将可以“预览”,而对于其他类似“ Product”,“ NewsArticle”,则没有预览选项。 在此处阅读第二点的技巧:https://developers.google.com/search/docs/guides/prototype