我需要在(Spring MVC + thymeleaf)网站上使用AMP技术和特定页面,遵循Create Your First AMP Page上的指南
验证器显示许多错误:
属性' xmlns'可能不会出现在顶级标签&#h; html中 HTML
标签' head>风格[amp-boilerplate] - 旧版本'已弃用 - 使用' head>式[安培样板]'代替。
标签内的强制性文字(CDATA)' head>风格[amp-boilerplate]旧版本'缺失或不正确。
代码:
<!doctype html>
<html amp xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/" lang="ar">
<head>
<title>Some title</title>
<meta charset="utf-8" />
<meta content="IE=edge" http-equiv="X-UA-Compatible" />
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<link rel="canonical" content="some-url-here" />
<style amp-boilerplate="">body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style>
<script async="" src="https://cdn.ampproject.org/v0.js"></script>
</head>
<body>
content is here
</body>
</html>
任何想法如何解决这个问题?
答案 0 :(得分:0)
我发现最好的方法是实现ur页面的另一种轻量级版本
例如:CNN已经参考了放大器版本 查看此页面的来源: http://edition.cnn.com/2017/01/31/politics/donald-trump-supreme-court-announcement/index.html这是放大器版本 https://amp.cnn.com/cnn/2017/01/31/politics/donald-trump-supreme-court-announcement/index.html
所以,对我而言,我将在不使用百里香的情况下实施新页面
答案 1 :(得分:0)
您可以毫无问题地使用xmlns标记,因为页面会在没有这些标记的情况下呈现自身。验证页面时,将html复制到浏览器验证,而不是从IDE验证。使用Chrome右击 - &gt;查看页面源为您提供干净的HTML。