amp-html - How to have AMP site working only for mobile and Desktop for normal desktop users
问题描述
We are pretty new to AMP setup and we are trying to move to AMP site only for mobile users.
We want our desktop site to be used as is for desktop user and when a mobile user search for that page it should give AMP page in search result.
My question is, is it the core behavior of AMP or do we need to have some kind of redirect setup based on screen size?
I know the tag is used to define the amp and non-amp site on them but does that mean that when a user search that page in desktop google search he/she will get only AMP page in search result?
解决方案
在您的情况下,您需要创建两个不同的 url,一个用于桌面,另一个用于移动:
例如
桌面网址:https ://www.example.com/home.html
AMP 网址:https ://www.example.com/home-amp.html
现在让您的页面可被发现
将以下内容添加到非 AMP 页面(桌面) - 在 home.html 文件中:
<link rel="amphtml" href="https://www.example.com/home-amp.html">
这到 AMP 页面 - 在 home-amp.html 文件中:
<link rel="canonical" href="https://www.example.com/home.html">
欲了解更多信息,请单击此处
推荐阅读
- apache-spark - Spark将前N个选定的行复制到一个新的数据框
- android - Android MVP Fragment Presenter 到 Activity
- ios - 准备 Segue 函数未正确传递数据
- mysql - MyTop 缩短数据库名称长度
- javascript - 如何从 HTML5 地图中删除一个区域?
- linux - Qt 静态构建并静态链接到 icu 库
- python - 如何在图表中正确绘制标签?
- jquery - 在给定 data-id 属性的情况下更新 jQuery 中的 TD 值
- javascript - 使用 PHP 获取由 JavaScript 代码设置的 cookie
- css - 消除首屏内容中的渲染阻塞 CSS