かずきち。の日記

サーバサイドエンジニアのつぶやき

Googleが推奨しているAMPに対応するために。あなたのページはAMP対応していますか?

AMPページとはなにか?

Googleが推奨するAMPページ。
さて、このAMPとは何でしょうか?

AMP(Accelerated Mobile Pages)とは、ひとことで言うならば「モバイルページを高速に表示させるための手法」のことです。

スマホ対応が云々カンヌンと言っている企業は多いですが、そもそもスマホ対応のhttps化っていうのは結構当然の話です。
ユーザビリティを最優先で考えるのであれば、https化とかも大事だとは思いますが、AMP対応することが求められます。
今どきパソコンでウェブページを見る人ってそんなにいませんからね…
経営者はどうしてもセキュリティとかこだわっちゃうのでしょうがないとは思いますが、私はhttps化に加えて、AMP対応もしなければいけないと思います。
AMPプロジェクトとは、そもそもモバイルユーザーのUX向上のためにGoogleとTwitter が協同して立ち上げたオープンソースプロジェクトです。

digitalidentity.co.jp
引用:
https://digitalidentity.co.jp/blog/seo/amp/what-is-amp.html


f:id:kazukichi_0914:20190406145414p:plain

私のtwitterアカウントなんかを検索してみると変わったスニペットで表示されますね。
そもそもスニペットってなんだよ?って人のために…
スニペットというのは検索エンジンの検索結果SERPs(Search Engine Result Pages)の形のことです。
企業のウェブ担はITの最前線を担う必要があります。

AMP化のコードを書いておきますね。

<!doctype html>
<html ⚡>
  <head>
    <meta charset="utf-8">
    <title>Sample document</title>
    <link rel="canonical" href="./regular-html-version.html">
    <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
    <style amp-custom>
      h1 {color: red}
    </style>
    <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "NewsArticle",
      "headline": "Article headline",
      "image": [
        "thumbnail1.jpg"
      ],
      "datePublished": "2015-02-05T08:00:00+08:00"
    }
    </script>
    <script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"></script>
    <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><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
    <script async src="https://cdn.ampproject.org/v0.js"></script>
  </head>
  <body>
    <h1>Sample document</h1>
    <p>
      Some text
      <amp-img src=sample.jpg width=300 height=300></amp-img>
    </p>
    <amp-ad width=300 height=250
        type="a9"
        data-aax_size="300x250"
        data-aax_pubname="test123"
        data-aax_src="302">
    </amp-ad>
  </body>
</html>

このコードがAMPのコードになります。

AMP HTMLの宣言
メタ要素の指定
構造化マークアップ
boilerplateの宣言
ライブラリの読み込み

です。
そして、GoogeのserchConsoleではAMPの動作チェックが行えますので、

"GoogleSerchConsole"
Google Search Console

自分のページがAMP対応しているのかチェックしてみてください。