Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
amp
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
ararajp
February 02, 2017
Technology
190
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
amp
ararajp
February 02, 2017
More Decks by ararajp
See All by ararajp
genda-referral-hiring
ararajp
0
110
グループ会社を横断したエンジニア組織の立ち上げと挑戦/GENDA-org-2023
ararajp
1
840
iOSアプリのバッテリー消費を意識する/iosdc2020-ios-battery
ararajp
3
5.4k
zzt-meetup.pdf
ararajp
2
1.9k
ios_ci
ararajp
0
210
Other Decks in Technology
See All in Technology
2026 TECHFRESH 畢業分享會 - 開發日常大解密!從領域驅動到企業級上線
line_developers_tw
PRO
0
1.3k
「勝手に広まる」人気 AI エージェントを爆速で作ろう!(AWS Summit Japan 2026講演資料)
minorun365
PRO
8
1.9k
GitHub Copilot 最新アップデート – 「一歩先」の実践活用術
moulongzhang
5
1.5k
データサイエンスを価値につなげるプロジェクト設計 〜 DS一年目が現場で得た気づき 〜
ysd113
1
280
フィジカル版Github Onshapeの紹介
shiba_8ro
0
290
FPGAの開発コンペでZephyrを使ってみた
iotengineer22
0
140
気づかぬうちにセキュリティ負債を生むAPIキー運用
sgwrmctk
0
180
AIAU_UMEMOGU_ninomiya_slide
ninomiya_ii
0
240
Kiro Ambassador を目指す話
k_adachi_01
0
110
iAEONの段階的リアーキテクト戦略 / iAEON's_Gradual_Re-architecture_Strategy
aeonpeople
0
230
LayerXにおけるセキュリティ管理の現在地と次の一手
tosho
0
240
人材育成分科会.pdf
_awache
4
300
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.7k
BBQ
matthewcrist
89
10k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
210
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
210
New Earth Scene 8
popppiees
3
2.3k
What does AI have to do with Human Rights?
axbom
PRO
1
2.2k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.2k
Accessibility Awareness
sabderemane
1
140
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.5k
First, design no harm
axbom
PRO
2
1.2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
160
Transcript
RailsͰͷAMP࣮ࣄྫ
Profile ߥҪ ༐ี 2006-2011 Yahoo!JAPAN 2011- VASILY.inc ʮiQONʯͱ͍͏ঁੑ͚ϑΝογϣϯαʔϏεΛ࡞͍ͬͯ·͢ https://www.iqon.jp/ tech.vasily.jp/
AMPɹɹ Accelerated Mobile Pages
AMPͱ ϞόΠϧϖʔδΛߴʹϢʔβʔಧ͚ΔͨΊʹൃͨ͠ϓϩδΣΫτ
None
࣮ʹਏ੍͍͕͋Δ
• ඞਢϚʔΫΞοϓ͕ଟ͍ • ࡞ͨ͠JavaScriptېࢭ • ༻ҙ͞Ε͍ͯΔAMP ComponentΛ༻ • CSSheadλά͔StyleཁૉͰΠϯϥΠϯͷΈ •
linkཁૉcanonical͚ͩ ͳͲͳͲ...
ݫ͍݅͠ԼͰखͬऔΓૣ͘Rails Ͱ࣮͠·͠ΐ͏
• routing • Controller • View • CSS
routing ௨ৗϖʔδͷURLʹ/ampΛ͚ͨ͠αϒςΟϨΫτϦํࣜ https://item.iqon.jp/15011036 // ௨ৗϖʔδ https://item.iqon.jp/15011036/amp // AMPϖʔδ get '/:item_id/amp',
to: 'item#amp', constraints: {item_id: /[0-9]+/} ?amp=1 / .ampͰஅͳͲαʔϏε͝ͱʹ߹͕ྑ͍ͷʹ͠·͠ΐ͏ αϒυϝΠϯͰ͍͚·͢
Controller PC/ϞόΠϧͱڞ௨ͷॲཧͰcanonical͚ͩઃఆ AMP༻ͷviewͱlayoutͰϨϯμϦϯά def amp if _detail # PC/ϞόΠϧͳͲͱڞ௨ͷॲཧ @html[:canonical]
= "https://item.iqon.jp/#{@item[:item_id]}/" # ϞόΠϧϖʔδcanonical render 'item/amp/detail', layout: 'amp/layout' # AMP༻ͷৄࡉϖʔδͱϨΠΞτ end end def sp @html[:amphtml] = "https:#{domain_item}/#{@item[:item_id]}/amp/" if params[:amp].blank? end
View ෆཁͳίϯϙʔωϯτͷJSΛಡΈࠐΉͱܯࠂ͕ग़Δ JSͷಡΈࠐΈॱݫີʹܾ·͍ͬͯΔ layout # ڞ௨ͷAMP JSlayoutͰಡΈࠐΉ script async=true custom-element="amp-analytics"
src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js" = yield(:extended_component_tags) script async=true src='https://cdn.ampproject.org/v0.js' Template content_for :extended_component_tags do script async=true custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"
CSS <link rel="stylesheet" href="">ېࢭ͞Ε͍ͯΔ ViewͰCSSΛrender͠ͳ͍ͱ͍͚ͳ͍ গ͢͠ΕίϯύΠϧ͕ඞཁͳSassͰ͏͜ͱ͕Մೳ
Template ༻͢ΔsassΛࢦఆ content_for :css_path, 'item/amp/show.sass' layout render_cssͱ͍͏ϔϧύʔΛ༻ style amp-custom=true =
render_css(yield :css_path)
Helper RubyεΫϦϓτ෦ͰSCSSΛCSSʹม͢Δ def render_css path raw Sass::Engine.for_file("#{Rails.root}/app/assets/stylesheets/#{path}", { load_paths: ["#{Rails.root}/app/assets/stylesheets"],
#importͷج४path style: :compressed # ѹॖ }).to_css end
·ͱΊ • ੍ଟ͍͕͢ΕϞόΠϧ͔Βมߋ͕গͳͯ͘ࡁΉ • AMPಋೖ͕ਐΜͰ͍·͢ɻະରԠͷ߹ใΛूΊ·͠ΐ͏
None
͋Γ͕ͱ͏͍͟͝·ͨ͠