html - 指出桌面版中的移动优化页面(html)

标签 html http seo googlebot

我有一个专为桌面设备设计和优化的页面 foo.bar/root,现在我想告诉搜索引擎 m.foo.bar/m-root 是同一个页面,但针对移动设备进行了优化,我该怎么做?
我应该在我的响应中添加什么样的标签(或 http header )来告诉亲爱的 Google 索引移动优化页面?

最佳答案

alternate link type “创建引用当前文档的替代表示的超链接”。使用 link 元素,它可能看起来像:

<!-- on the desktop page <http://example.com/foo/> -->
<link href="http://m.example.com/foo/" rel="alternate">

您还可以使用 media attribute指定“资源适用于哪些媒体”(根据您的喜好调整媒体查询):

<!-- on the desktop page <http://example.com/foo/> -->
<link href="http://m.example.com/foo/" rel="alternate" media="only screen and (max-width: 640px)">

这是普通的 HTML5 方式。

根据 Google’s documentation , Google 似乎也能识别此标记。

关于html - 指出桌面版中的移动优化页面(html),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27845680/

相关文章:

javascript - 使用指令模块化网站的 HTML 结构

php - php 中 getimagesize() 的有效替代方法

http - 从浏览器发送http PUT/GET/DELETE/POST请求

php - Google PageSpeed 第三方聊天加载问题

php - PHP表单数据到多个MySQL条目

javascript - 从 JSON 到关联数组到 html 表

php - 我的 WP 博客中的图片在其他网站上不显示

javascript - Angular4 无法向 yii2 应用程序发送发布请求

url - 菜鸟关于 mod 重写和相对 url 的问题

seo - Opencart Seo Url 在删除 Url 的某些部分时也可以工作