html - 非规范 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 索引页)。
我在这里想要的是这样的:
- www.example.com/index.htm(非 Amp,桌面版)
- www.example.com/mobile/index.php(非 Amp,移动版)
- 一个带有 Amp index.htm 文件的新子文件夹(名为珠宝)。此链接将在 example.com/index.htm 页面和 example.com/mobile/index.php 页面中提供(在导航栏中)。
- 如果有桌面用户和/或移动用户单击该链接,他/她将登陆 example.com/jewelry/index.htm 页面(amp 版本)。
我一直在互联网上寻找是否可以在 amp html 页面中使用如下元名称放置代码,但我找不到它:
<meta name="description" content="bla bla bla">
<meta name="keywords" content="blu blu blu">
所以,我的问题是:
我可以将元名称“描述”和“关键字”放在 amp 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">
推荐阅读
- python - 在 bash 中生成多个 python 脚本
- vue.js - 如何修复从源头访问 XMLHttpRequest 已被 nuxtjs 中的 CORS 策略阻止?
- python - 如何获取和设置具有二维矩阵列索引的一维数组?
- c++ - 这两者在c ++中有什么区别
- reactjs - userfirestoreforprofile 为真,但未在控制台的 firebase.profile 中显示数据
- sql-server - 如何在 SQL Server 中将 int 转换为 datetime?
- reactjs - AWS权限不能putObject
- azure - Azure az container create 未通过尝试挂载卷完成
- java - 如何修复错误:已弃用不必要地替换不存在的任务
- javascript - 如何禁用下拉菜单中已选择的选项?