Googleã®PageSpeed Insightsã§ãµã€ãã®ã¹ã³ã¢ã枬ã£ãæã«ãã¬ã³ããªã³ã°ã劚ãããªãœãŒã¹ã®é€å€ããšããé ç®ãåºãŠæ¥ãŸããã§ãããïŒ
ä»åã¯ãæ¹åé ç®ããã©ã°ã€ã³Autoptimizeã䜿ã£ãŠãµã¯ããšè§£æ±ºããŠããŸãæ¹æ³ãã玹ä»ããŸãïŒ
Autoptimizeã§åºæ¥ãäº
Autoptimizeã®èšå®æ¹æ³
Autoptimizeã®æ³šæç¹
ãªãããµã€ãé«éåã®æ¹æ³ãããã°é«éåã®æ¹æ³ãšéèŠæ§ïŒãwordpressåå¿è ããã«ã€ããŠã¯ãã¡ãã®èšäºãã©ãã
Contents
- 1.Autoptimizeã§åºæ¥ãäº
- 2.Autoptimizeã®èšå®æ¹æ³
- ã€ã³ã¹ããŒã«ãšæå¹å
- JavaScriptãªãã·ã§ã³ã®èšå®
- CSSãªãã·ã§ã³ã®èšå®
- HTMLãªãã·ã§ã³ã®èšå®
- CDNãªãã·ã§ã³ä»¥éã®èšå®
- è¿œå èšå®ïŒè¿œå ã®èªåæé©åïŒ
- Google ãã©ã³ã
- çµµæåãåé€
- éçãªãœãŒã¹ããã¯ãšãªãŒæååãåé€
- ãµãŒãããŒãã£ã®ãã¡ã€ã³ã«äºåæ¥ç¶ãã (äžçŽãŠãŒã¶ãŒåã)
- ç¹å®ã®ãªã¯ãšã¹ããããªããŒãããïŒäžçŽãŠãŒã¶ãŒïŒ
- éåæ JavaScript ãã¡ã€ã«Â (äžçŽãŠãŒã¶ãŒåã)
- YouTube åç»ã®æé©å
- 3.Autoptimizeã®æ³šæç¹
- ãŸãšã
1.Autoptimizeã§åºæ¥ãäº
ããŒã䞻婊ããèšããããšãæ¥ãªã客ãããæ¥ããããšããããèŠããç¯å²ã ãããããŒã£ãšçä»ããŠãããããæ¥åžžçã«æ£ããã£ãŠãæ£ã®æŽçãã¹ãããªããŠãããæŽçåçŽã¢ããã€ã¶ãŒã¿ãããªããããããã©ã°ã€ã³ã§ãïŒ
掻çšãã€ã³ã
Googleã®PageSpeed Insightsã§ãµã€ãã®ã¹ã³ã¢ã枬ã£ãæã«æ¹åé ç®ãšããŠããããã¬ã³ããªã³ã°ã劚ãããªãœãŒã¹ã®é€å€ãã«éåžžã«æå¹ã§ãïŒ
ã©ãããäºããšãããš
ãã¬ã³ããªã³ã°ã劚ãããªãœãŒã¹ã®é€å€ãã®æ¹åé ç®ã«ãäžèšã®æ¹åæ¹æ³ãæ€èšããŠäžãããšè¡šç€ºããããšæããŸã
ããŒãžã® First Paint ããªãœãŒã¹ããããã¯ããŠããŸããéèŠãª JavaScript ã CSS ã¯ã€ã³ã©ã€ã³ã§é ä¿¡ãããã以å€ã® JavaScript ãã¹ã¿ã€ã«ã¯ãã¹ãŠé ãããããšããæ€èšãã ããã
ããã®æå³ã¯ããã£ããèšããšç»é¢ã§æåã«èŠããç¯å²é¢ä¿ããJavaScript ã CSS ãæåã«ããŠãé¢ä¿ãªããã®ã¯åŸããèªã¿èŸŒã¿ããŸãããïŒã£ãŠäºã§ã
æ¥ãªã客ãããèŠããæãããŒãã«ã®äžãããããšçä»ããŠãšããããèŠããç¯å²ãçä»ãããªããŠããšãããŸãããïŒã客ãããå ¥ããªãéšå±ããããªãçä»ãå§ããäºã¯ããªããšæããŸãã
ãããªæãã§ãå ã«ãµã€ãã«è¡šç€ºãããæã ãéäžããŠJavascriptãªã©ãåãããŠãé¢ä¿ã®ãªãéšåã¯ãã®ä»ã®åŠçãçµãã£ãŠããåãããŸããããšããæå³ã§ã
ãŸããæ¥ã æ£ããããã¡ãªæ£ãããã¡ãç®±ãè¡£è£ ã±ãŒã¹ãå®æçã«ãããã«çã¥ããŠãããã¿ãããªæãã§ãã³ãŒããæé©åããŠãããã®ãAutoptimizeã§ã
ãªãããã©ã°ã€ã³ãã€ã³ã¹ããŒã«ããåã«ã¯ããã¯ã¢ãããåãããšãããããããŸããwordpressã®ããã¯ã¢ãããšåŸ©å ãããæ¹æ³ããåå¿è ãè¶ ç°¡åãwordpressããã¯ã¢ããïŒåŸ©å ããæ¹æ³ïŒãã«ã€ããŠã¯ãã¡ãã®èšäºãã©ãã
ãåå¿è ãè¶ ç°¡åãwordpressããã¯ã¢ããïŒåŸ©å ããæ¹æ³ïŒ
ç¶ããèŠã
2.Autoptimizeã®èšå®æ¹æ³
Â
- ã€ã³ã¹ããŒã«ãšæå¹å
- JS,CSSïŒHTMLã®èšå®
- è¿œå èšå®
ãã€ã³ã
ãã©ã°ã€ã³ã§è¡šç€ºã«äžå ·åãçããå Žåãããã®ã§ãèšå®åã«ããã¯ã¢ãããåã£ãŠãããšå®å šã§ãïŒ
ã€ã³ã¹ããŒã«ãšæå¹å
â¡ã€ã³ã¹ããŒã«æå¹å
JavaScriptãªãã·ã§ã³ã®èšå®
åé ç®ã®èª¬æ
â JavaScript ã³ãŒãã®æé©å
ãã¡ã€ã«å ã®æ¹è¡ãªã©ãåãé€ããŠJavaScriptãã¡ã€ã«ãå§çž®ããŠãããŸã
â¡JS ãã¡ã€ã«ãé£çµãã
ãªã³ã¯ãããŠããJavaScriptãã¡ã€ã«ãããããã³ã°ããªãããéã¬ã³ããªã³ã°ãšããŠããŒãããããã«éçŽãããã©ããã®èšå®
â¢ã€ã³ã©ã€ã³ã® JS ãé£çµ
HTMLããJavaScriptãæœåºããŠé£çµãããã©ããã®èšå®
èŠå: ããã«ãããAutoptimize ã®ãã£ãã·ã¥ãµã€ãºãæ¥éã«å¢å ããããšããããŸããäœãããŠããã®ãç解ããŠããå Žåã®ã¿æå¹åããŠãã ããã
衚瀺ãåäœã«äžå ·åãçããå Žåãããã®ã§ãã泚æãã ãã
â£<head> å ãž JavaScript ã匷å¶
<head>å ãžJavaScriptã匷å¶çã«é 眮ããJavaScriptãæ©ãã«èªã¿èŸŒã¿ãããããã©ããã®èšå®
泚æã³ã¡ã³ããããããã«ã¬ã³ããªã³ã°ãããã¯ãçºçããã®ã§ãã§ãã¯ã¯ããããããŸãã
â€Autoptimize ããã¹ã¯ãªãããé€å€:
Autoptimizeã®ã³ãŒãæé©åãé©çšããªãã¹ã¯ãªãããèšå®ããŸã
â¥try-catch ã®æãè¿ããè¿œå
ãšã©ãŒãæ€ç¥ã§ããããã«ãããã©ããã®èšå®ãéåžžã¯ãã§ãã¯ããå¿ èŠã¯ãããŸãã
CSSãªãã·ã§ã³ã®èšå®
â¡ãã¹ãŠã®CSSãã€ã³ã©ã€ã³åã¯å¿ èŠãªå Žåã®ã¿ãã§ãã¯
â CSS ã³ãŒããæé©å
CSSã³ãŒããæé©åãããŸã
â¡CSS ãã¡ã€ã«ãé£çµãã
ãªã³ã¯ãããŠããCSSãã¡ã€ã«ãã²ãšã€ã«å§çž®ãããã©ãããèªã¿èŸŒããã¡ã€ã«æ°ãæžããããšã«ãã£ãŠãéä¿¡åæ°ãæžãããµã€ãèªã¿èŸŒã¿é床ã®åäžãèŠèŸŒããŸãã
â¡ã«ãã§ãã¯ãå ¥ãããšãâ¢ã€ã³ã©ã€ã³ã® CSS ãé£çµãâ£ããŒã¿ãçæ : ç»åã URI åãâ¥ãã¹ãŠã® CSS ãã€ã³ã©ã€ã³åã«ãã§ãã¯ãå ¥ããäºãåºæ¥ãããã«ãªããŸã
â¢ãâ£ãâ¥ã¯åäœã§ãªãâ¡ãšäœµçšã§æå¹ãšãªããŸãã
â¢ã€ã³ã©ã€ã³ã® CSS ãé£çµ
HTMLå ã«èšè¿°ãããŠããCSSã察象ã«ãããã©ããã«ã€ããŠã§ãããã§ãã¯ãå ¥ãããšãHTMLãã¡ã€ã«å ã®CSSãé£çµããŸãã
â£ããŒã¿ãçæ : ç»åã URI å
åå¥ã«ç»åãããŠã³ããŒããããCSSèªäœã«å°ããªèæ¯ç»åãå«ããããšãã§ããŸããããã«ãããµãŒããŒãªã¯ãšã¹ãæ°ãæžå°ããããŒãžè¡šç€ºé床ã®é«éåãæããŸã
衚瀺ã«äžå ·åãçããå Žåãããã®ã§ã泚æãã ãã
â€CSS ã®ã€ã³ã©ã€ã³åãšé 延
HTMLããŒãžã®èªã¿èŸŒã¿ã®åŸã«CSSãé 延ããŠããŒããããã©ããã®èšå®ã§ã
Autoptimizeã®ææãµãŒãã¹ãšçµã¿åãããå Žåã®ã¿æå¹
â¥ãã¹ãŠã® CSS ãã€ã³ã©ã€ã³å
CSSã³ãŒããHTMLãã¡ã€ã«ãšå¥ãã¡ã€ã«ã«ãããåã蟌ããã©ããã®èšå®
ãHTMLã®ãµã€ãºãå€§å¹ ã«å¢å ãããããäžè¬çã«ã¯ãå§ãã§ããŸããããšãããŸãããç§ã®å Žåãã¡ãã®ãã§ãã¯ãå€ããšã¹ã³ã¢ãèœã¡ãã®ã§ããã§ãã¯ãå ¥ããŠããŸããäžå ·åãåºãã確èªããªãããã§ãã¯ãããå€æããŠã¿ãŠäžããã
âŠAutoptimize ãã CSS ãé€å€
Autoptimizeã®ã³ãŒãæé©åãé©çšããªãCSSãèšå®ããŸã
HTMLãªãã·ã§ã³ã®èšå®
HTMLã³ãŒããæé©å
HTMLã³ãŒããæé©ååŠçã®å¯Ÿè±¡ã«ãããã©ããã®èšå®
HTMLã³ã¡ã³ããæ®ã
HTMLå ã®ã³ã¡ã³ããæ®ããã©ããã®èšå®
ã³ã¡ã³ããåé€ã転é容éãæžããããå Žåã¯ãã§ãã¯ãå ¥ããŸãã
CDNãªãã·ã§ã³ä»¥éã®èšå®
CDN ã®ããŒã¹ URL
CDNãšã¯ãContent Delivery Networkãã®ç¥ã§ããåäžã®ã³ã³ãã³ããã å€ãã®é åžå ãäŸãã°å€ãã®ãŠãŒã¶ãŒã®ç«¯æ«ã«å¹ççã«é åžããããã«äœ¿ãããä»çµã¿ã§ã
CDNãå©çšããŠããªãå Žåã¯ãç¹ã«èšè¿°ããå¿ èŠã¯ãããŸãã
é£çµãããã¹ã¯ãªãã / CSS ãéçãã¡ã€ã«ãšããŠä¿å
ã³ã¡ã³ãã®éããæ£ããåŠçããªãå Žåã¯ããã®ãªãã·ã§ã³ã®ãã§ãã¯ãå€ããŠãã ããã
é€å€ãããCSSãã¡ã€ã«ãšJSãã¡ã€ã«ãçž®å°ãã
æé©åããé€å€ãã.jsãã¡ã€ã«ã.cssãã¡ã€ã«ã«ã€ããŠãç¬ç«æ§ãç¶æããç¶æ ã§ïŒïŒä»ã®åçš®ã®ãã¡ã€ã«ãšé£çµãããªãã§ïŒã³ãŒãã®æé©åã ããããªãããšãã§ããŸãã
é€å€ããŠãããŸããããªãå Žåã¯ããã®ãªãã·ã§ã³ãå€ããŠãã ããã
ãã°ã€ã³äžã®ãŠãŒã¶ãŒãæé©åããŸãã ?
ããã·ã¥ããŒãã«ãã°ã€ã³ããŠãããŠãŒã¶ãŒããAutoptmizeã«èšå®ããæé©åãæå¹ã«ãããã©ããã®èšå®
ãã®ä»ãŠãŒã¶ãŒãšåãç°å¢ã«ããæ¹ããäžå ·åã®çºèŠã容æã«ãªãããšæãã®ã§ããã§ãã¯ã¯å ¥ããŠãããæ¹ãããããšæããŸã
ç»åïŒImages)ã®èšå®
ç»åïŒImages)ã®èšå®ã¯ãç¹ã«å¿ èŠãããŸãã
é 延ããŒãç³»ã®ãã©ã°ã€ã³ã䜿ã£ãŠããå Žåã¯ãäžå ·åãçããå Žåãããã®ã§ãã¡ãã«ã¯ãã§ãã¯ãå ¥ããªãã§ãã ããã
è¿œå èšå®ïŒè¿œå ã®èªåæé©åïŒ
ãã€ã³ã
ãã§ãã¯ããé ç®ã¯ãç°å¢ã«ãã£ãŠç°ãªãã®ã§é©çšããããé ç®ã®ã¿ãã§ãã¯ããŸãããïŒ
Google ãã©ã³ã
Googleãã©ã³ãã䜿çšããŠããªãå Žåã¯ãGoogleãã©ã³ãã®åé€ã«ãã§ãã¯
䜿çšããŠããå Žåã¯ãäžèšã®ã©ã¡ãã
- webfont.js ã§éåæã«ãã©ã³ããçµåããŠèªã¿èŸŒã
- çµåããŠãããã«ããªããŒãããŸãïŒãã©ã³ãã®ããŒãã¯é
ããªããŸãããã¬ã³ããªã³ã°ããããã¯ããŸããïŒ
display:swap
ã
ç§ã¯äžã®éåæã®æ¹ãžãã§ãã¯ãå ¥ããŠããŸãããåäœãèŠãªããé©çšããŠã¿ãŠäžãã
çµµæåãåé€
Twitterãªã©ã§äœ¿ãããŠããçµµæåãwordpressã§ã䜿çšã§ããŸãããããã䜿ã£ãŠããªãå Žåã¯åé€ã«ãã§ãã¯ãå ¥ããŸã
éçãªãœãŒã¹ããã¯ãšãªãŒæååãåé€
ã¯ãšãªæååã¯çç±ããã£ãŠä»ãããã®ã§ããçºããã§ãã¯ã¯ããããããŸãã
ãµãŒãããŒãã£ã®ãã¡ã€ã³ã«äºåæ¥ç¶ãã (äžçŽãŠãŒã¶ãŒåã)
PageSpeed Insightsã®èšºæã«ç¬¬äžè ã³ãŒãã®åœ±é¿ãæããŠãã ãããšåºãå Žåãªã©ã«äœ¿çšããŸã
ç¹å®ã®ãªã¯ãšã¹ããããªããŒãããïŒäžçŽãŠãŒã¶ãŒïŒ
äºåèªã¿èŸŒã¿ããããªãœãŒã¹ã®URLãã«ã³ãåºåãã§æå®ãã
éåæ JavaScript ãã¡ã€ã«Â (äžçŽãŠãŒã¶ãŒåã)
éåæã§ããŒãããå¿ èŠãããå Žåã®èšå®ïŒãã©ã°ã€ã³Async Javascriptã䜿çšãããšçŽ°ããªèšå®ãåºæ¥ãïŒ
YouTube åç»ã®æé©å
ãã©ã°ã€ã³WP YouTube Lyte ã䜿ã£ãŠyoutubeã®æé©åãã§ããŸã
3.Autoptimizeã®æ³šæç¹
- 衚瀺ã«äžå ·åãçºçãã
- CSSãåæ ãããªã
å¿ ãããçºçããããã§ã¯ãªãã§ãããããããã³ã¡ã³ããå€æ°ãããŸãã
衚瀺ã«äžå ·åãçºçãã
å ·äœçãªäŸã¯
- ã¬ã€ã¢ãŠãã厩ãã
- ç»åã衚瀺ãããªã
- åºåã衚瀺ãããªã
- ã¢ãã€ã«ã®ã¿ã¡ãã¥ãŒãã¿ã³ãªã©ã®è¡šç€ºãå°ãããªã
解決æ¹æ³
Â
JavaScript ãªãã·ã§ã³ã®<head> å ãž JavaScript ã匷å¶ãžãã§ãã¯ãå ¥ãã
ãŸãã¯
CSSãªãã·ã§ã³ã®CSS ã³ãŒããæé©åã®ãã§ãã¯ãå€ã
ãã€ã³ã
衚瀺ã®æ¹åãšPageSpeed Insightsã®ã¹ã³ã¢ãèŠãªãããäžã€äžã€ç¢ºèªããŠã¿ãŠäžãã
CSSãåæ ãããªã
- èªåã§CSSãè¿œå ããã«ã¹ã¿ãã€ãºãããåæ ãããªãïŒ
解決æ¹æ³
step
1ã³ãŒãã®èšè¿°ã«ééããªãã確èªãã
step
2ãã£ãã·ã¥ãåé€ãã
Autoptimizeãã€ã³ã¹ããŒã«ãããšäžã®ã¡ãã¥ãŒããŒã®æã«Autoptimizeã®ã¡ãã¥ãŒãè¿œå ãããŸã
ããã«ããŠã¹ãæã£ãŠè¡ããšã¡ãã¥ãŒãéãã®ã§ãã£ãã·ã¥ãåé€ãã¯ãªãã¯ãã
ããã§ãåæ ãããªãå Žå
step
3ãªãã·ã§ã³ã®ãã§ãã¯ãå€ã
- CSSãªãã·ã§ã³ã®ã€ã³ã©ã€ã³ã® CSS ãé£çµ
- ãã¹ãŠã® CSS ãã€ã³ã©ã€ã³å
- JavaScript ãªãã·ã§ã³JSãã¡ã€ã«ãé£çµããã®ãã§ãã¯ãå€ã
ãã¡ããã©ãã察å¿ãããã¯ã䜿ã£ãŠããããŒããç°å¢ã«ãã£ãŠå€ãã£ãŠæ¥ãã®ã§äžã€äžã€ç¢ºèªããŠã¿ãŠäžãã
ãŸãšã
Googleã®PageSpeed Insightsã§ãµã€ãã®ã¹ã³ã¢ã枬ã£ãæã«åºãŠãããã¬ã³ããªã³ã°ã劚ãããªãœãŒã¹ã®é€å€ãããã©ã°ã€ã³Autoptimizeã䜿ã£ãŠæ¹åããæ¹æ³ã«ã€ããŠè§£èª¬ããŸãã
ãµã€ãã®é«éåãšããŠéåžžã«æå¹ãšãããŠãããã©ã°ã€ã³Autoptimizeã§ãããç°å¢ã«ãã£ãŠã¯äžå ·åãçºçããå Žåãããã®ã§ã䜿çšããå Žåã¯å¿ ãããã¯ã¢ãããåã£ãŠããå®è¡ããŸãããïŒ