最近、
作成途中の
検証対象の AMP HTML の 特性
検証対象の
django の
template ファイル AMP Start - Accelarated Mobile Pages Templates の
blog テーマ を 元に、 template を 編集中
The AMP Validator に ついて
Accelerated Mobile Pages Project – AMP が
AMP の
The AMP Validator に
HTML を
AMP と
だいたい、
出力される エラーに ついて
エラーだけではなく、
以下、
The property ‘minimum-scale’ is missing from attribute ‘content’ in tag ‘meta name=viewport’.
原因 metaタグ、
viewport
に、minimum-scale
属性がないため 発生していました。
mezzanine/base.html at master · stephenmcd/mezzanine のviewport
記述をそのまま 流用していて 発生していたようでした。 対策
AMP Start
のBlog テンプレートの 記述を 参考に 以下のように 記載しました。 <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1">
The mandatory attribute ‘target’ is missing in tag ‘FORM [method=GET]’.
原因 form タグに
target 属性が ないため 発生しています。 対策
form タグにtarget 属性を 追加しました。
自画面に対して submit を 行うため、 target="_self"
を追加しましたが、
amp は、target="_blank"
または、target="_top"
のどちらかしか
指定ができないようで、 修正後に 以下警告が 出力されました。 最終的にThe attribute 'target' in tag 'FORM [method=GET]' is set to the invalid value '_self'.
指定は、 target="_top"
としました。
The tag ‘script’ is disallowed except in specific forms.
原因
script タグを使っている ために、 出力されていました。 対策
不要なscript タグ であったので、 記述を 削除しました。
The mandatory tag ‘link rel=canonical’ is missing or incorrect.
原因
link rel=canonical
タグがないため、 出力されていました。 対策
template に
<link rel="canonical" href="{{ request.get_full_path }}">
を追加しました。
The mandatory tag ‘meta charset=utf-8’ is missing or incorrect.
原因
必須タグ ‘meta charset = utf-8’がないため、 出力されていました。 対策 タグ
<meta charset="utf-8">
を追加しました。
The mandatory attribute ‘amp-custom’ is missing in tag ‘style amp-custom’.
原因
style タグ にamp-custom
属性がないため、 出力されていました。 対策
つけ忘れ。です。いや、 コピペして 書いてるだけだったので、 気が つきませんでした。
The tag ‘style amp-custom’ appears more than once in the document.
原因
style amp-custom
が複数回登場している ため、 出力されていました。 対策
1つにまとめました。
エラーと
以上です。
コメント