AMP対å¿ããã¾ã§ã«å¤±æãããã¨
èªç¤¾ãµã¼ãã¹ãAMP対å¿ããã®ã§ããã®æä¸ã«å¤±æããäºã®ã¡ã¢ã§ãã
AMPã¨ã¯
失æãããã¨
- ã¬ã¹ãã³ã·ãã§ç¸¦å¹ åºå®ã®æ ã«ç»åã表示ããããªã amp-img ã¯ä½¿ããªã
- ãµã¼ããã¼ãã£ã§å°ç¨ã®ã³ã³ãã¼ãã³ããããå ´åããã
- #development=1 ã¯å®ç§ã§ã¯ãªã
- AMPãã¼ã¸ã¸ã®ãªã³ã¯ã¯PCãã¼ã¸ã«ç½®ããªãã¨ãããªã
ã¬ã¹ãã³ã·ãã§ç¸¦å¹ åºå®ã®æ ã«ç»åã表示ããããªã amp-img ã¯ä½¿ããªã
AMPãã¼ã¸ã§ç»åã表示ãããå ´åamp-imgã¨ããå°ç¨ã®ã¿ã°ã使ãã¾ãã
ç»åãã¬ã¹ãã³ã·ãã§è¡¨ç¤ºãããå ´åã¯ãlayout="responsive"ããæå®ãã¾ãã
ãã®layoutãè¨å®ãã¡ããã¨widthã¨ãheightã¨ãã¬ã³ç¡è¦ãã¦è¡¨ç¤ºããã¡ããã¾ãã
ãã®ç¶æ
ã§CSSãããã£ã¦ãã©ãã«ããªãã¾ããã§ããã
解決çã¯amp-imgã使ããã« CSSã§backgroun-imageã使ããã¨ã§ãã
HTML
<div class="responsive-imge"></div>
.responsive-imge { width: 100%; height: 200px; position: relative; box-sizing: border-box; background-size: cover; background-repeat: no-repeat; background-position-x: 50%; background-position-y: 50%; background-image:url(https://ampbyexample.com/img/amp.jpg); }
ãããªæãã§ããããããææ³ã§ããã
ãã AMP対å¿ããã¨ããã¨ãç»åã¯amp-imgã使ããªããé§ç®ã£ã¦è¨è¿°ãæ£è¦ãããã®ã§ãã¦ã£ããCSSã§æå®ã¯åºæ¥ãªãããã ã¨æãããã§ã¾ããã
ãµã¼ããã¼ãã£ã§å°ç¨ã®ã³ã³ãã¼ãã³ããããå ´åããã
ããã¯ãªãã¡ã¬ã³ã¹ã¡ããã¨èªãã£ã¦çµè«ã«è³ããã§ããã»ã»ã»ã
ä¸è¨ã®ãã¼ã¸ã«ã¯AMPå°ç¨ã®ã¿ã°ã¨ã³ã³ãã¼ãã³ããç¾
åããã¦ã¾ã
Accelerated Mobile Pages Project
YoutubeãInstagramè¦ãããªå¤§ããæ以å¤ã«ãè²ã
使ããã³ã³ãã¼ãã³ããããã¾ãã
è¦ç´ã§ä¿åãç¦æ¢ããã¦ããµã¼ããã¼ãã£APIãå¤ãã®ã§ãjavascriptã使ããªãAMPã§ã¯ããããã³ã³ãã¼ãã³ãã使ããªãã¨è¡¨ç¤ºã§ãã¾ããã
ãããç¥ãã¾ã§ã¯é å¼µã£ã¦ãµã¼ãã¼ã§APIåå¾ãã¦cronåãã¦ä½ã£ã¦ã¾ããã
#development=1 ã¯å®ç§ã§ã¯ãªã
ãã¥ã¼ããªã¢ã«ã§AMPã®ãã¼ã¸ã確èªããã¨ãã¯Chromeã§URLã«ã#development=1ããä»ãã¦DeveloperToolsã使ã£ã¦ç¢ºèªããã¨æ¸ãã¦ããã¾ãã
ããã§åºãã¨ã©ã¼ãä¿®æ£ããã°OKã ãè¦ãããªæ¸ãæ¹ãã¦ã¾ããããã®ã¢ã¼ãã¯å®ç§ã§ã¯ãªãã§ããï¼ä»å¾è§£æ¶ãããããï¼
ãã®ã¢ã¼ãã§ä¿®æ£ãã¦OKãåºã¦ããå®éã«é
ä¿¡ããã¨ã¨ã©ã¼ãåºããã¨ãããã¾ãã
ã¡ããã¨ããããªãã¼ã·ã§ã³ã¯ä¸è¨ã®2ã¤ã®ãã¼ã«ã使ã£ã¦æ¤è¨¼ããå¿
è¦ãããã¾ãã
https://validator.ampproject.org/
構造化データ テストツール
åè
ã¯AMPè¨æ³ã¨ãã¦æ£ãããããã§ãã¯ãã¦ããã¾ãã
å¾è
ã¯æ§é åãã¼ã¿ãæ£ãããããã§ãã¯ãã¦ããã¾ãã
<script type="application/ld+json"> ~~~ </script>
ãããªæãã§æ§é åãã¼ã¿ããã¼ã¯ã¢ãããã¦ããã¤ã§ãã
ãã®2ã¤ã®ãã¼ã«ã§OKãããããªãã¨ã¨ã©ã¼ã¨èªèããã¦æ²è¼ããã¾ããã
AMPãã¼ã¸ã¸ã®ãªã³ã¯ã¯PCãã¼ã¸ã«ç½®ããªãã¨ãããªã
<link rel="amphtml" href="http://amphtml/index.html">
ãããªãã¤ã§ãã
ããã«ä¸çªãããã¾ããã
æ¸ãã¦ããéããªãã§ãããAMPãã¼ã¸ã¸ã®ãªã³ã¯ã¯PCã§è¦ããã¼ã¸ã«è¨ç½®ããªãã¨Googleã«ã¯èªèãã¦ãããã¾ããã
ã¬ã¹ãã³ã·ããµã¤ãã¨ãã§ãã¨åé¡ãªãã§ãããPCã¨ã¹ããã¨ãã§ãã³ãã¬ã¼ããåãåãã¦ãå ´åã¯æ³¨æãå¿
è¦ã§ãã
åã確èªããéãã§ã¯ãªãã¡ã¬ã³ã¹ã«ã¯PCãã¼ã¸ã«è¨ç½®ãã¦ãè¦ãããªè¨è¿°ã¯ç¡ãã§ãã
ã¢ãã¤ã«ã§è¦ãã¨ãã«æ©ã表示ããããã®ãã®ãªã®ã«ä½æ
ï¼ã¨æãã¾ãããã
ããããAMP対å¿ãããã¨æãæ¹ã®åèã«ãªãã°ã