Google AMP-仅在通过Google搜索结果访问时显示启用AMP的页面 [英] Google AMP - displaying AMP-enabled pages only when accessed via Google search results

查看:255
本文介绍了Google AMP-仅在通过Google搜索结果访问时显示启用AMP的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已要求我为我们的新闻网站设置Google加速移动页面(AMP),以便在移动设备上更快地加载页面.我才刚刚开始,但有一个问题似乎在官方文档中找不到答案.

I have been asked to set up Google Accelerated Mobile Pages (AMP) for our news websites, so that pages will load faster on mobile devices. I've just started on this and I have a question to which I can't seem to find the answer in the official documentation.

仅当通过Google搜索结果页面访问网页时,才打算显示该网页的AMP版本吗?因此,如果网站访问者正在其移动浏览器上访问新闻文章,但是他们直接在不通过Google的情况下在其地址栏中输入了网站地址,是否仍应向他们显示该页面的现有(非AMP)版本?到目前为止,我已经在内容管理系统中添加了一个复选框,CMS用户(例如网站编辑器)必须选中该复选框以为特定站点启用AMP,然后在输出模板文件中检查该复选框是否具有被打勾,如果是的话,网站访问者将被带到该页面的AMP版本.因此,我有点担心,这表示无论网站访问者是否通过Google搜索结果访问了该网页,他们都将看到AMP版本.在AMP文档中,它说我们需要包括一个规范链接,以将每个文档的AMP版本和非AMP版本链接在一起.这样可以解决上述问题吗?

Is the AMP version of a webpage only intended to be displayed when it is accessed via the Google Search results page? So, if a site visitor is accessing a news article on their mobile browser but they entered the site address directly into their address bar without going via Google, should they still be shown the existing (non-AMP) version of the page? So far, I've added a checkbox in our content management system which the CMS user (eg a site editor) has to tick to enable AMP for a particular site, and then in the output template files I check to see if the checkbox has been ticked, and if so, the site visitor will be taken to the AMP version of the page. So I’m a bit concerned that this means the mobile site visitor will be shown the AMP version regardless of whether or not they accessed the page via the Google search results. In the AMP documentation it says that we need to include a canonical link to link the AMP and non-AMP versions of each document together. Would this resolve the above-mentioned issue?

我注意到,《卫报》已经设置了其AMP实现,以便您可以用amp替换URL的www部分,这会将访问者带到该页面的AMP版本,而不是标准版本.我不确定他们是如何做到的-有人对此有任何解释吗?

I noticed that The Guardian has set up their AMP implementation so that you can replace the www part of the URL with amp, and that will take the visitor to the AMP version of the page instead of the standard version. I’m not sure how they’ve done that - does anyone have any explanation of this?

推荐答案

由您决定是否将访问者从您的网站引导到AMP页面. 《卫报》和大多数其他发行商设置的方式是同时存在AMP和非AMP页面.如果您直接访问他们的网站,则将获得非AMP页面.因此,当从Google搜索结果轮播访问或直接通过AMP URL访问时,仅提供AMP页面.该参考链接供爬虫程序知道是否有AMP/非AMP页面.

It is up to you if you want to send visitors to AMP pages or not from your website. The way The Guardian, and most other publishers, has set it up is that there is both an AMP and non-AMP page. If you visit their site directly, you will be served the non-AMP page. So only the AMP pages are served when accessed from the Google search results carousel or accessed directly by the AMP URL. The reference link is for crawlers to be able to know if there is an AMP/non-AMP page or not.

您可以执行监护人"操作的一种基本方法是拥有一个非AMP页面,其中amphtml链接引用指向AMP页面. IE. 非AMP页面:

One basic way you could do what The Guardian has done is have a non-AMP page with the amphtml link reference pointing to the AMP page. ie. non-AMP Page:

mywebsite.abc/<slug to story>

AMP页面:

mywebsite.abc/amp/<slug to story>

我希望这会有所帮助.对于每个故事,我们都有一个amphtml参考链接,该链接指向一个模板,该模板接受故事ID并返回该故事的AMP HTML标记.

I hope this helps. What we have is for each story, there is an amphtml reference link pointing to a template that takes in the story ID and returns the AMP HTML markup for the story.

这篇关于Google AMP-仅在通过Google搜索结果访问时显示启用AMP的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆