Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
AMP 完全に理解した
Search
bakunyo
September 22, 2018
Technology
450
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
AMP 完全に理解した
bakunyo
September 22, 2018
Transcript
30 slides
AMP 完全に理解した 2018/09/22 【第4回】JSフレームワーク(またはライブラリ)× ビアバッシュ 初⼼者勉強会 Izuta Hiroyuki
⾃⼰紹介 • ⽒名: いずた ひろゆき • Twitter・GitHub: @bakunyo • フリーランスエンジニア
https://twitter.com/ito_yusaku/status/1042604780718157824 ちょい前にバズってたやつ
࣍ • AMP 概要 • 事例紹介 • AMP の今後
AMP 概要
AMP って何 • Accelerated Mobile Pages の略 • Google が中⼼となって進めているオープンソースプロジェクト
• モバイル環境でも快適・⾼速にウェブサイトを閲覧できるよう にするための仕組み ←モバイルのGoogle検索結果 でこのマークがついてるページは AMP対応済
AMP の構成要素 • AMP HTML • AMP JS • AMP
Cache
AMP HTML • パフォーマンスを維持するために制限が課せられたHTML • ⼀部は AMP 固有タグに置き換えられる(amp-xxx) • 制限の例
• CSS は head 内にインライン記述 • JS は基本的に使⽤できない(AMP JSを除く)
AMP JS • AMP HTML で利⽤が許された JS の外部リソース • async
で読み込むため、レンダリングブロックしない • 後ほどいくつか紹介
AMP Cache • AMP が有効なページをキャッシュして返すコンテンツ配 信ネットワーク • = Google AMP
Cache • 後ほどもう少し詳しく
AMP 概要 おさらい • AMP HTML • パフォーマンスのために制限が課せられたHTML • AMP
JS • AMP HTML で使える JS 外部リソース • AMP Cache • AMP ⽤コンテンツ配信ネットワーク
事例紹介
事例紹介 • 最新巻.jp • “巻” なので注意 • マンガの最新巻情報をお知らせ • 全ページAMP対応
• レスポンシブ
AMP JS コンポーネント紹介
amp-image-lightbox 画像タップでフルスクリーン表⽰ ※あの丸⼭ゴンザレスさん著作の グルメ漫画(9/21発売)
amp-lightbox-gallery 複数の画像をまとめられる フォトギャラリー 横スライドで次の画像へ
amp-iframe AMP で iframe が使えるようになるタグ 漫画のコマが著作権的に安⼼して使える マンガルーさん( https://mangaloo.jp/ )の
埋め込みフレームに利⽤ iframe の中では実は JS が使える
AMP JS を使った実装( amp-img の例) 1. タグ毎に必要な JS ライブラリを head
で async 読み込み <script async src="https://cdn.ampproject.org/v0.js"></script> 2. AMP 固有タグを使う <amp-img {src, alt, layout などのタグ毎に必要な属性}></amp-img> 3. 基本的にこれだけ ゆとりに優しい仕様
AMP Cache をもう少し詳しく
スマホで「最新巻jp」の検索結果 Google 検索結果 Yahoo! JAPAN 検索結果
Google 検索結果 → AMP ⽤ページ www.google.jp/amp/s/{ドメイン} にて配信される (⽶ Google では
.com) CDNから配信されていることを⽰すヘッダー をクリックするとキャッシュ元ページへ 遷移する 【メタタグ関連】 ・robots = noindex ・canonical はキャッシュ元ページ
search.yahoo.co.jp/amp/s/{ドメイン}/… にて配信される ヘッダーの挙動、メタタグともに Googleとほぼ同じ Yahoo! JAPAN 検索結果 → AMP⽤ページ
中⾝は iframe Google も Yahoo も、同じURLを 参照 最新巻-jp.cdn.ampproject.org
というサブドメインが切られている Google AMP Cache ドキュメント https://developers.google.com/amp/cache/ にサブドメインのルールについて記載がある
なので URL開けば普通に⾒れる ←ヘッダー表⽰⽤スペースもあり AMP Cache コンテンツ配信プラット フォームは、ヘッダー部分を独⾃実装 して
iframe で中⾝を指定してやれば いけそう
流れ再確認 (PPHMF".1$BDIF \υϝΠϯ^DEOBNQQSPKFDUPSH (PPHMFݕࡧ".1༻ϖʔδ XXXHPPHMFKQBNQT\υϝΠϯ^ :BIPPݕࡧ".1༻ϖʔδ TFBSDIZBIPPDPKQBNQT\υϝΠϯ^ ①検索結果がAMP Cache済 ならAMP⽤ページを表⽰
②iframeから参照
AMP の今後
イベント • AMP Contributor Summit • https://events.withgoogle.com/amp-contributor-summit/ • 2018/09/25-26 @Google
in Mountain View, California • AMP Roadshow • https://www.ampproject.org/amp-roadshow/ • 来⽉、インドの3都市にて開催
Bing 9⽉19⽇にアナウンス Introducing Bing AMP viewer and Bing AMP cache
https://blogs.bing.com/Webmaster-Blog/September-2018/Introducing- Bing-AMP-viewer-and-Bing-AMP-cache ※⼿元では確認できず
使ってみての感想 • AMP の制限を守ろうとすると、⾃然とパフォーマンスが よくなる • AMP JS でできることがどんどん増えているため、サイト をつくるうえで困ることがそんなに無くなってくる
• もう少し⾒守ります
APPENDIX • 公式サイト • https://www.ampproject.org/ • AMP by Example •
https://ampbyexample.com • GitHub • https://github.com/ampproject • Google AMP Cache ドキュメント • https://developers.google.com/amp/cache/ • Yahoo!検索ヘルプ AMP対応ページ表⽰について • https://www.yahoo-help.jp/app/answers/detail/p/595/a_id/138177/~/ amp%E5%AF%BE%E5%BF%9C%E3%83%9A%E3%83%BC%E3%82%B8%E8%A1%A8%E7%A4%BA%E3 %81%AB%E3%81%A4%E3%81%84%E3%81%A6
More Decks by bakunyo
See All by bakunyo
合宿成果@日本色
bakunyo
0
150
GitHub Actions CI/CD Update
bakunyo
0
310
NNにふれてみて
bakunyo
0
1.1k
RoRoRoRoR
bakunyo
0
1k
Other Decks in Technology
See All in Technology
人の努力に頼らないセキュリティをエンジニアリングする在り方 / An approach to engineering security that does not rely on human effort
carta_engineering
0
250
メルカリの小規模チーム「Pod」で、 エンジニアがデータアナリストなしで、 AIを使ってデータ分析の自走を目指す取り組み
jackojacko_
1
360
kubellの最新データ分析環境
kubell_hr
2
270
Amazon EFS のマルウェアスキャンをClamAV で自前実装したら苦労した話
mtmtfactory01
0
120
[DBRE Summit 26] DBRE はデータベース運用をどう変えたのか
_awache
0
140
MCPでネットワーク障害調査を自動化する前に直すべき3つのこと
yama3133
1
670
そのイメージ、どのCIが作った? Artifact Attestationsで来歴を固定する / Which CI system created that image? Pinning provenance with Artifact Attestations
chmikata
0
280
パスワードのない鍵で、 データを手元に置く
ginjihayashi
0
400
こんなに変わった! AWSネットワークの常識
shotashiratori
16
12k
その修正で本当に速くなったのか? k6とOpenTelemetryで確かめる性能改善 / Performance review with k6 and OpenTelemetry
ymotongpoo
3
450
ポケモンバトルのAIエージェント
koji_kawamura
0
250
デザインシステムのフィードバックループをほぼ自動化した話
tongari07
0
520
Featured
See All Featured
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
121
130k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
330
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Done Done
chrislema
187
17k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
1
320
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
320
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
850
The Spectacular Lies of Maps
axbom
PRO
1
1.2k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
3k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1.1k
Abbi's Birthday
coloredviolet
5
11k
Facilitating Awesome Meetings
lara
57
7.2k