官术网_书友最值得收藏!

Validating your AMP pages

We'll be seeing more about validation in the next chapter. For now, you just need to know that your AMP pages must validate before they will be added to the AMP Cache. The easiest way to check if your page is valid is to append #development=1 to the URL of the page in the browser address bar, and open up the Developer Tools (Cmd + Opt + I on Mac, Ctrl + Shift + I on Windows), and navigate to the Console tab. You'll then get a report for your page, indicating if it's valid. The page we just created should validate as follows:

Successful AMP validation in Chrome developer console

If it's not valid, you'll get some helpful error messages for any failures. To see this in action, remove the line that begins with <link rel="canonical"...> from your code and reload the page with #development=1 at the end of the URL. This time the validator informs us that the mandatory canonical tag is missing:

AMP validation reports an error for an invalid page

You'll need to add that line back in before the page validates again. But even if it doesn't validate, it will still render in most modern web browsers, since AMP is HTML-based. You will lose out on the benefits of the AMP Cache however.

主站蜘蛛池模板: 兴安县| 武穴市| 武清区| 勃利县| 郸城县| 吴堡县| 永兴县| 尼玛县| 南投县| 涿州市| 东海县| 内江市| 南充市| 六枝特区| 临泽县| 清水县| 余庆县| 郓城县| 松原市| 依安县| 深水埗区| 阳朔县| 古丈县| 汤阴县| 乐都县| 曲麻莱县| 彭阳县| 胶州市| 盱眙县| 房山区| 息烽县| 临西县| 巴楚县| 稻城县| 安吉县| 抚松县| 阳山县| 大丰市| 西乌| 黎平县| 贵港市|