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

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

问题描述

我被要求为我们的新闻网站设置 Google Accelerated Mobile Pages (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.

网页的 AMP 版本是否仅在通过 Google 搜索结果页访问时才显示?因此,如果网站访问者在他们的移动浏览器上访问新闻文章,但他们直接将网站地址输入到地址栏中,而没有通过 Google 访问,他们是否仍会看到页面的现有(非 AMP)版本?到目前为止,我已经在我们的内容管理系统中添加了一个复选框,CMS 用户(例如站点编辑器)必须勾选该复选框才能为特定站点启用 AMP,然后在输出模板文件中我检查该复选框是否具有已勾选,如果是,网站访问者将被带到页面的 AMP 版本.所以我有点担心这意味着移动网站访问者将看到 AMP 版本,无论他们是否通过 Google 搜索结果访问该页面.在 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?

我注意到 The Guardian 已经设置了他们的 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天全站免登陆