首页 > 解决方案 > 非规范 amp html 中的元名称?

问题描述

我已经有一个网站:
1. www.example.com ---> 是桌面版(非放大器) 2. www.example.com/mobile ---> 是移动版(非放大器)

在桌面版的 index.htm 页面中,我放了:

<title>blo blo blo</title>
<meta name="description" content="bla bla bla">
<meta name="keywords" content="blu blu blu">
<link rel="alternate" media="only screen and (max-width: 1024px)"
href="http://www.example.com/mobile/index.php">

<script type="text/javascript">
<!--
if (screen.width <= 1024) {
window.location = "http://www.example.com/mobile/index.php";
}
//-->
</script>

还有手机版的index.php页面,我放:

<title>blo blo blo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="bla bla bla">
<meta name="keywords" content="blu blu blu">
<link rel="canonical" href="http://www.example.com/index.htm">

请不要问我为什么我有桌面版本的 index.htm 和移动版本的 index.php,因为我自己已经忘记了几年前我为什么这样做:)。

无论如何,它有效。如果我在手机浏览器中输入“www.example.com”,则会显示“www.example.com/mobile/index.php”页面。如果我在桌面浏览器中键入“www.example.com”,那么它会显示“www.example.com/index.htm”页面。

现在我想在子文件夹中添加一个新页面,但我只想制作一个版本(这是一个 amp html 页面),而不是为桌面和移动设备制作两个版本。

我从互联网上的一些文章中读到,一个 amp html 页面可能适用于两个版本(桌面版和移动版),从 这里它说:

AMP HTML 文件需要一个指向常规 HTML 的规范链接。 如果不存在 HTML 版本,它应该指向它自己

所以,我假设在这个新的 amp html 页面的子文件夹中,我应该将代码放在这样的位置:

<link rel="canonical" href="http://www.example.com/jewelry/index.html">

该链接指向自身的位置(珠宝子文件夹中的 amp html 索引页)。

我在这里想要的是这样的:

我一直在互联网上寻找是否可以在 amp html 页面中使用如下元名称放置代码,但我找不到它:

<meta name="description" content="bla bla bla">
<meta name="keywords" content="blu blu blu">

所以,我的问题是:
我可以将元名称“描述”和“关键字”放在 amp html 页面中吗?

任何形式的回应将不胜感激。
提前谢谢你。

标签: htmlmeta-tagsamp-html

解决方案


You need to put meta tag in main file non-amp page and also add the tag to make your page discoverable

<link rel="amphtml" href="http://www.example.com/mobile/index.php">

推荐阅读