์ ํจ์ฑ ๊ฒ์ฌ ์ค๋ฅ ํด๊ฒฐ
์ด ์น์ ์์๋ AMP ํ์ด์ง์ ์๋ AMP ์ ํจ์ฑ ๊ฒ์ฌ ์ค๋ฅ ๋ฐ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์ดํด๋ด ๋๋ค. ์ฝ์์ ๋ฐ๋ผ ์ค๋ฅ๊ฐ ์๋์ ๋ค๋ฅธ ์์๋ก ๋ํ๋ ์ ์์ต๋๋ค.
๋ฌธ์ ์งํฉ ํฌํจ
์ฐ์ ๋ค์ ์ค๋ฅ๋ฅผ ํด๊ฒฐํด ๋ณด๊ฒ ์ต๋๋ค.
The mandatory tag 'meta charset=utf-8' is missing or incorrect.
AMP์์ ํ
์คํธ๋ฅผ ์ฌ๋ฐ๋ฅด๊ฒ ํ์ํ๋ ค๋ฉด ํ์ด์ง์ ๋ฌธ์ ์งํฉ์ ์ง์ ํด์ผ ํฉ๋๋ค. ๋ํ ๋ฉํ ๋ฌธ์ ์งํฉ ์ ๋ณด๋ <head> ํ๊ทธ์ ์ฒซ ๋ฒ์งธ ํ์ ์์์ฌ์ผ ํฉ๋๋ค. ์ด ํ๊ทธ๋ฅผ ์ฒซ ๋ฒ์งธ๋ก ์ฌ์ฉํด์ผ ํ๋ ์ด์ ๋ ๋ฉํ ๋ฌธ์ ์งํฉ ํ๊ทธ ์์ ์ถ๊ฐ๋ ์ฝํ
์ธ ๋ฅผ ๋ค์ ํด์ํ๋ ์ผ์ ํผํ๊ธฐ ์ํด์์
๋๋ค.
๋ค์ ์ฝ๋๋ฅผ <head> ํ๊ทธ์ ์ฒซ ๋ฒ์งธ ์ค์ ์ถ๊ฐํฉ๋๋ค.
<meta charset="utf-8" />
ํ์ผ์ ์ ์ฅํ๊ณ ํ์ด์ง๋ฅผ ์๋ก๊ณ ์นจํฉ๋๋ค. ๋ฌธ์ ์งํฉ ์ค๋ฅ๊ฐ ๋ ์ด์ ํ์๋์ง ์๋์ง ํ์ธํฉ๋๋ค.
ํ์ค ๋งํฌ ํฌํจ
์ด์ ๋ค์ ์ค๋ฅ๋ฅผ ์ดํด๋ณด๊ฒ ์ต๋๋ค.
The mandatory tag 'link rel=canonical' is missing or incorrect.
๋ชจ๋ AMP ๋ฌธ์์๋ ํด๋น ๋ฌธ์์ 'ํ์ค' ๋ฒ์ ์ ์ฐธ์กฐํ๋ ๋งํฌ๊ฐ ์์ด์ผ ํฉ๋๋ค. ์ด ๊ฐ์ด๋์ ํฌํจ๋์ด ์๋ ํ์ด์ง๋ฅผ ๊ฒ์ํ ์ ์๋๋ก ์ค์ ๋จ๊ณ์์ ํ์ค ํ์ด์ง๋ ๋ฌด์์ด๋ฉฐ ํ์ค ์ฐ๊ฒฐ์ ์ฌ์ฉํ ์ ์๋ ์ ๊ทผ๋ฐฉ์์ผ๋ก๋ ์ด๋ค ๊ฒ์ด ์๋์ง ์์ธํ ์์๋ณด๊ฒ ์ต๋๋ค.
์ด ๊ฐ์ด๋์์๋ ๋ณํ ์ค์ธ ์๋ณธ HTML ๋ฌธ์๋ฅผ ํ์ค ํ์ด์ง๋ก ๊ฐ์ฃผํฉ๋๋ค.
๊ณ์ํด์ <meta charset="utf-8" /> ํ๊ทธ ์๋์ ๋ค์ ์ฝ๋๋ฅผ ์ถ๊ฐํฉ๋๋ค.
<link rel="canonical" href="/article.html" />
<link rel="canonical" href="article.amp.html" />
์ด์ ํ์ด์ง๋ฅผ ์๋ก๊ณ ์นจํฉ๋๋ค. ์์ง ์์ ํด์ผ ํ ์ค๋ฅ๊ฐ ๋ง์ง๋ง ํ์ค ๋งํฌ ์ค๋ฅ๋ ๋ชจ๋ ์ฌ๋ผ์ก์ต๋๋ค.
AMP ์์ฑ ์ง์
ํ์ด์ง๋ฅผ AMP ๋ฌธ์๋ก ์ ์ธํ๋ ค๋ฉด ํ์ด์ง์ ๋ฃจํธ <html> ์์์ ์์ฑ์ด ํ์ํฉ๋๋ค.
The mandatory attribute 'โก' is missing in tag 'html โก for top-level html' The mandatory tag 'html โก for top-level html' is missing or incorrect.
์์ ํ์๋ ์ค๋ฅ๋ ๋ค์๊ณผ ๊ฐ์ด <html> ํ๊ทธ์ โก ์์ฑ์ ์ถ๊ฐํ๋ฉด ๊ฐ๋จํ ํด๊ฒฐ๋ฉ๋๋ค.
<html โก lang="en"></html>
์ด์ ํ์ด์ง๋ฅผ ์๋ก๊ณ ์นจํ๊ณ ๋ ์ค๋ฅ๊ฐ ๋ชจ๋ ์ฌ๋ผ์ก๋์ง ํ์ธํฉ๋๋ค.
โก์ ์ง์ ํ๋ ๊ฒ์ด ๊ถ์ฅ๋๋ ๋ฐฉ๋ฒ์ด์ง๋ง ๋ค์๊ณผ ๊ฐ์ด โก ์์ฑ ์๋ฆฌ์ amp ์์ฑ์ ์ฌ์ฉํ ์๋ ์์ต๋๋ค.
<html amp lang="en"></html>
ํ์ ์์ญ ์ง์
์ด์ ๋ค์ ์ค๋ฅ๋ฅผ ํด๊ฒฐํด ๋ณด๊ฒ ์ต๋๋ค.
The mandatory tag 'meta name=viewport' is missing or incorrect.
AMP์์๋ ํ์ ์์ญ์ width ๋ฐ minimum-scale์ ์ ์ํด์ผ ํฉ๋๋ค. ์ด ๊ฐ์ ๊ฐ๊ฐ device-width ๋ฐ 1๋ก ์ ์๋์ด์ผ ํฉ๋๋ค. ํ์ ์์ญ์ HTML ํ์ด์ง์ <head>์ ํฌํจ๋์ด ์๋ ์ผ๋ฐ์ ์ธ ํ๊ทธ์
๋๋ค.
ํ์ ์์ญ ์ค๋ฅ๋ฅผ ํด๊ฒฐํ๋ ค๋ฉด ๋ค์์ HTML ์ค๋ํซ์ <head> ํ๊ทธ์ ์ถ๊ฐํฉ๋๋ค.
<meta name="viewport" content="width=device-width" />
width ๋ฐ minimum-scale์ ์ง์ ๋ ๊ฐ์ AMP์์ ์๊ตฌ๋๋ ๊ฐ์
๋๋ค. initial-scale ์ ์๋ ํ์ ํญ๋ชฉ์ ์๋์ง๋ง ๋ชจ๋ฐ์ผ ์น ๊ฐ๋ฐ ๊ณผ์ ์ ์ผ๋ฐ์ ์ผ๋ก ํฌํจ๋๋ฉฐ ๊ถ์ฅ๋๋ ์ฌํญ์
๋๋ค. ํ์ ์์ญ ๊ตฌ์ฑ์์ ํ์ ์์ญ ๋ฐ ๋ฐ์ํ ๋์์ธ์ ๊ดํด ์์ธํ ์์๋ณผ ์ ์์ต๋๋ค.
์ด์ ๊ณผ ๋ง์ฐฌ๊ฐ์ง๋ก ํ์ด์ง๋ฅผ ์๋ก๊ณ ์นจํ๊ณ ์ค๋ฅ๊ฐ ์ฌ๋ผ์ก๋์ง ํ์ธํฉ๋๋ค.
์ธ๋ถ ์คํ์ผ์ํธ ๊ต์ฒด
๋ค์์ ์ค๋ฅ๋ ์คํ์ผ์ํธ ์ฌ์ฉ๊ณผ ๊ด๋ จ๋์ด ์์ต๋๋ค.
The attribute 'href' in tag 'link rel=stylesheet for fonts' is set to the invalid value 'base.css'.
ํนํ ์ด ์ค๋ฅ๋ <head> ํ๊ทธ์ ์๋ ๋ค์๊ณผ ๊ฐ์ ์คํ์ผ์ํธ ๋งํฌ ํ๊ทธ์ ๊ด๋ จ๋์ด ์์ต๋๋ค.
<link href="base.css" rel="stylesheet" />
๋ฌธ์ ๋ ์ธ๋ถ ์คํ์ผ์ํธ๋ฅผ ์ฐธ์กฐํ ๋ฐ์ ๋ฐ์ํฉ๋๋ค. ๋ฌธ์๋ฅผ ๊ฐ๋ฅํ ํ ๋นจ๋ฆฌ ๋ก๋ํ๊ธฐ ์ํด AMP์๋ ์ธ๋ถ ์คํ์ผ์ํธ๋ฅผ ํฌํจํ ์ ์์ต๋๋ค. ๋์ ๋ชจ๋ ์คํ์ผ์ํธ ๊ท์น์ <style amp-custom></style> ํ๊ทธ๋ฅผ ์ฌ์ฉํ์ฌ AMP ๋ฌธ์์ ์ธ๋ผ์ธ์ผ๋ก ์ถ๊ฐ๋์ด์ผ ํฉ๋๋ค.
<style amp-custom>
/* The content from base.css */
</style>
์ด์ ์ค๋ฅ๋ฅผ ํด๊ฒฐํด ๋ณด๊ฒ ์ต๋๋ค.
<head>์์ ์ธ๋ถ ์คํ์ผ์ํธ๋ฅผ ๊ฐ๋ฆฌํค๋<link>ํ๊ทธ๋ฅผ ์ญ์ ํ๊ณ ์ด๋ฅผ ์ธ๋ผ์ธ<style amp-custom></style>ํ๊ทธ๋ก ๊ต์ฒดํฉ๋๋ค. ์คํ์ผ ํ๊ทธ์amp-custom์์ฑ์ ํ์์ ๋๋ค.base.cssํ์ผ์ ์๋ ๋ชจ๋ ์คํ์ผ์ ๋ณต์ฌํ์ฌ<style amp-custom></style>ํ๊ทธ์ ๋ถ์ฌ๋ฃ์ต๋๋ค.
๋ค์ ํ๋ฒ ํ์ด์ง๋ฅผ ์๋ก๊ณ ์นจํ๊ณ ์คํ์ผ์ํธ ์ค๋ฅ๊ฐ ์ฌ๋ผ์ก๋์ง ํ์ธํฉ๋๋ค.
ํ์ฌ ์๋ฐ์คํฌ๋ฆฝํธ ์ ์ธ
CSS๋ฅผ ์ธ๋ผ์ธ ์ฒ๋ฆฌํ๋ฉด ์คํ์ผ์ํธ๋ฅผ AMP๋ก ๋น๊ต์ ์ฝ๊ฒ ๋ค์ ์์ฑํ ์ ์์ง๋ง ์๋ฐ์คํฌ๋ฆฝํธ์์๋ ๊ทธ๋ ์ง ์์ต๋๋ค.
The tag 'script' is disallowed except in specific forms.
์ผ๋ฐ์ ์ผ๋ก AMP์์ ์คํฌ๋ฆฝํธ๋ ๋ ๊ฐ์ง ์ฃผ์ ์๊ตฌ์ฌํญ์ ๋ฐ๋ฅด๋ ๊ฒฝ์ฐ์๋ง ํ์ฉ๋ฉ๋๋ค.
- ๋ชจ๋ ์๋ฐ์คํฌ๋ฆฝํธ๋ ๋น๋๊ธฐ์์ด์ด์ผ ํฉ๋๋ค(์ฆ, ์คํฌ๋ฆฝํธ ํ๊ทธ์
async์์ฑ์ ํฌํจํด์ผ ํจ). - AMP ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ฐ ํ์ด์ง์ ์๋ AMP ๊ตฌ์ฑ์์์ฉ์ผ๋ก ์๋ฐ์คํฌ๋ฆฝํธ๋ฅผ ์ฌ์ฉํด์ผ ํฉ๋๋ค.
์ด์ ๊ฐ์ ์๊ตฌ์ฌํญ์ผ๋ก ์ธํด ๋ค์์ ๋ช ์๋ ๊ฒฝ์ฐ๋ฅผ ์ ์ธํ๊ณ ๋ AMP์์ ๋ชจ๋ ์ฌ์ฉ์ ์์ฑ/ํ์ฌ ์๋ฐ์คํฌ๋ฆฝํธ์ ์ฌ์ฉ์ด ์ฌ์ค์ ๋ฐฐ์ ๋ฉ๋๋ค.
- ์คํฌ๋ฆฝํธ๊ฐ ํ์ด์ง์ ๋ฉํ๋ฐ์ดํฐ๋ฅผ ์ถ๊ฐํ๊ฑฐ๋ AMP ๊ตฌ์ฑ์์๋ฅผ ๊ตฌ์ฑํฉ๋๋ค. ์ด๋ฌํ ์คํฌ๋ฆฝํธ์๋
application/ld+json๋๋application/json์ ํ ์์ฑ์ด ํฌํจ๋ฉ๋๋ค. - ์คํฌ๋ฆฝํธ๊ฐ iframes์ ํฌํจ๋์ด ์์ต๋๋ค. iframe์ ์๋ฐ์คํฌ๋ฆฝํธ๋ฅผ ํฌํจํ๋ ์ผ์ ์ตํ์ ์๋จ์ผ๋ก ์๊ฐํด์ผ ํฉ๋๋ค. ๊ฐ๋ฅํ๋ค๋ฉด ์๋ฐ์คํฌ๋ฆฝํธ ๊ธฐ๋ฅ์ AMP ๊ตฌ์ฑ์์๋ฅผ ์ฌ์ฉํ์ฌ ๋์ฒดํด์ผ ํฉ๋๋ค. ๋ค์ ์น์ ์์ ์ฒซ ๋ฒ์งธ AMP ๊ตฌ์ฑ์์๋ฅผ ์ดํด๋ณด๊ฒ ์ต๋๋ค.
์ธ๋ถ base.js ํ์ผ์ ์ด์ด ๋ณด์ธ์. ๋ฌด์์ด ํ์๋๋์? ์ด ํ์ผ์๋ ์๋ฐ์คํฌ๋ฆฝํธ ์ฝ๋๊ฐ ์์ด์ผ ํ๋ฉฐ ๋ค์๊ณผ ๊ฐ์ ์ ๋ณด์ ์ฃผ์๋ง ํฌํจ๋์ด ์์ด์ผ ํฉ๋๋ค.
/*
This external JavaScript file is intentionally empty.
Its purpose is merely to demonstrate the AMP validation error related to the
use of external JavaScript files.
*/
์ด ์ธ๋ถ ์๋ฐ์คํฌ๋ฆฝํธ ํ์ผ์ ์น์ฌ์ดํธ์ ๊ธฐ๋ฅ ๊ตฌ์ฑ์์๊ฐ ์๋๋ฏ๋ก ์ฐธ์กฐ๋ฅผ ์์ ํ ์ญ์ ํ ์ ์์ต๋๋ค.
๋ฌธ์์์ ๋ค์ ์ธ๋ถ ์๋ฐ์คํฌ๋ฆฝํธ ์ฐธ์กฐ๋ฅผ ์ญ์ ํฉ๋๋ค.
<script type="text/javascript" src="base.js"></script>
์ด์ ํ์ด์ง๋ฅผ ์๋ก๊ณ ์นจํ๊ณ ์คํฌ๋ฆฝํธ ์ค๋ฅ๊ฐ ์ฌ๋ผ์ก๋์ง ํ์ธํฉ๋๋ค.
AMP CSS ์์ฉ๊ตฌ ํฌํจ
๋ค์ ์ค๋ฅ๋ ๋๋ฝ๋ ์์ฉ๊ตฌ ์ฝ๋๋ฅผ ์ฐธ์กฐํฉ๋๋ค.
The mandatory tag 'noscript enclosure for boilerplate' is missing or incorrect. The mandatory tag 'head > style : boilerplate' is missing or incorrect. The mandatory tag 'noscript > style : boilerplate' is missing or incorrect.
๋ชจ๋ AMP ๋ฌธ์์๋ ๋ค์๊ณผ ๊ฐ์ AMP ์์ฉ๊ตฌ ์ฝ๋๊ฐ ํ์ํฉ๋๋ค.
<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
>
๋ฌธ์์ <head> ํ๊ทธ ํ๋จ์ ์์ ์์ฉ๊ตฌ ์ฝ๋๋ฅผ ์ถ๊ฐํฉ๋๋ค.
<style amp-boilerplate> ํ๊ทธ๋ฅผ ์ฌ์ฉํ๋ฉด AMP ์๋ฐ์คํฌ๋ฆฝํธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ๋ก๋๋ ๋๊น์ง ๋ณธ๋ฌธ ์ฝํ
์ธ ๊ฐ ์จ๊ฒจ์ง๋ฉฐ, ๊ทธ๋ฐ ๋ค์ ์ฝํ
์ธ ๊ฐ ๋ ๋๋ง๋ฉ๋๋ค. AMP์์๋ ์คํ์ผ์ด ์ ์ฉ๋์ง ์์ ์ฝํ
์ธ ๊ฐ ๋ ๋๋ง๋๋ ์ผ, ์ฆ FOUC(Flash Of Unstyled Content)๋ฅผ ๋ฐฉ์งํ๊ธฐ ์ํด ์ด๋ฌํ ์์
์ ์ํํฉ๋๋ค. ์ด๋ฅผ ํตํด ํ์ด์ง์ ์ฝํ
์ธ ๊ฐ ํ๊บผ๋ฒ์ ํ์๋๋ฉฐ ์คํฌ๋กค ์์ด ๋ณผ ์ ์๋ ๋ถ๋ถ์ด ํ ๋ฒ์ ๋ ๋๋ง๋๋ฏ๋ก ์ฌ์ฉ์ ํ๊ฒฝ์์ ์ง์ ํ ์๋ฏธ์ ์ฆ๊ฐ์ฑ์ ๊ฒฝํํ ์ ์์ต๋๋ค. ๋ ๋ฒ์งธ ํ๊ทธ๋ ์๋ฐ์คํฌ๋ฆฝํธ๊ฐ ๋ธ๋ผ์ฐ์ ์์ ์ฌ์ฉ ์ค์ง๋ ๊ฒฝ์ฐ ์ด ๋
ผ๋ฆฌ๋ฅผ ๋๋๋ฆฝ๋๋ค.
<img>๋ฅผ <amp-img>๋ก ๋์ฒด
AMP์์๋ ๋ฏธ๋์ด๋ฅผ ํ์ํ ๋ ๊ธฐ๋ณธ HTML์ ์์ํ๋ ํ์ด์ง๋ฅผ ์ง์ํ์ง ์์ผ๋ฏ๋ก ๋ค์๊ณผ ๊ฐ์ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
The tag 'img' may only appear as a descendant of tag 'noscript'. Did you mean 'amp-img'?
AMP์๋ <img> ํ๊ทธ๋ฅผ ๋์ฒดํ๊ธฐ ์ํด ํน๋ณํ ๋ง๋ค์ด์ง ์น ๊ตฌ์ฑ์์์ธ <amp-img> ํ๊ทธ๊ฐ ์์ต๋๋ค.
<amp-img src="mountains.jpg"></amp-img>
<img> ํ๊ทธ๋ฅผ ์์ ์ค๋ช
๋ <amp-img> ํ๊ทธ๋ก ๊ต์ฒดํ๊ณ ๊ฒ์ฌ๊ธฐ๋ฅผ ๋ค์ ์คํํฉ๋๋ค. ๋ค์๊ณผ ๊ฐ์ด ์ฌ๋ฌ ๊ฐ์ง ์๋ก์ด ์ค๋ฅ๊ฐ ํ์๋ ๊ฒ์
๋๋ค.
Layout not supported: container The implied layout 'CONTAINER' is not supported by tag 'amp-img'.
amp-img๊ฐ ๋ค๋ฅธ ์ค๋ฅ๋ฅผ ์ ๋ฐํ๋ ์ด์ ๋ ๋ฌด์์ผ๊น์? amp-img๋ ์ ํต์ ์ธ HTML img ํ๊ทธ๋ฅผ ์ง์ ์ ์ผ๋ก ๋์ฒดํ์ง ์๊ธฐ ๋๋ฌธ์
๋๋ค. amp-img๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด ์ถ๊ฐ ์๊ตฌ์ฌํญ์ด ์์ต๋๋ค.
AMP ๋ ์ด์์ ์์คํ
๋ ์ด์์ ์ค๋ฅ๋ฅผ ํตํด amp-img๊ฐ container ๋ ์ด์์ ์ ํ์ ์ง์ํ์ง ์๋๋ค๋ ์ฌ์ค์ ์์์ต๋๋ค. AMP ๋์์ธ์์ ๊ฐ์ฅ ์ค์ํ ๊ฐ๋
์ค ํ๋๋ ์นํ์ด์ง๋ฅผ ๋ ๋๋งํ๋ ๋ฐ ํ์ํ DOM ๋ฆฌํ๋ก์ฐ์ ์์ ์ค์ด๋ ๊ฒ์
๋๋ค.
DOM ๋ฆฌํ๋ก์ฐ๋ฅผ ์ค์ด๊ธฐ ์ํด AMP์๋ ํ์ด์ง๋ฅผ ๋ค์ด๋ก๋ํ๊ณ ๋ ๋๋งํ๋ ์ฃผ๊ธฐ ์ค ํ์ด์ง์ ๋ ์ด์์์ ๊ฐ๋ฅํ ํ ๋น ๋ฅด๊ฒ ํ์ ํ๊ธฐ ์ํ ๋ ์ด์์ ์์คํ ์ด ํฌํจ๋์ด ์์ต๋๋ค.
์๋ ์ด๋ฏธ์ง๋ HTML ํ์ด์ง๊ฐ ์ด๋ป๊ฒ ๋ฐฐ์น๋๋์ง๋ฅผ AMP์ ์ ๊ทผ๋ฐฉ์๊ณผ ๋น๊ตํ์ฌ ๋ณด์ฌ์ค๋๋ค. ์ผ์ชฝ์์ ๊ด๊ณ ๋๋ ์ด๋ฏธ์ง๊ฐ ๋ก๋๋ ๋๋ง๋ค ํ ์คํธ๊ฐ ์ด๋ป๊ฒ ๋ฆฌํ๋ก์ฐ๋๋์ง ์ ์ฌํ ์ดํด๋ณด์ธ์. ๋ฐ๋ฉด AMP์ ๋ ์ด์์ ์ ๊ทผ๋ฐฉ์์์๋ ์ด๋ฏธ์ง ๋ฐ ๊ด๊ณ ๊ฐ ๋ก๋๋๋ ๋ฐ ์๊ฐ์ด ์ค๋ ๊ฑธ๋ฆฌ๋๋ผ๋ ํ ์คํธ๊ฐ ์๋ค๊ฐ๋ค ์์ง์ด์ง ์์ต๋๋ค.
AMP ๋ ์ด์์ ์์คํ ์์๋ ํ์ด์ง์ ์๋ ๊ตฌ์ฑ์์๊ฐ ํฌ๊ธฐ ๊ณ ์ , ๋ฐ์ํ ๋์์ธ, ๋์ด ๊ณ ์ ๋ฑ ๋ค์ํ ๋ฐฉ์์ผ๋ก ๋ฐฐ์น ๋ฐ ํ์ฅ๋ ์ ์์ต๋๋ค.
์ฌ๊ธฐ์๋ ๋ ์ด์์ ์์คํ
์ด amp-img์ ๋ ์ด์์ ์ ํ์ container ์ ํ์ผ๋ก ์ถ์ ํ์ต๋๋ค. ํ์ง๋ง container ์ ํ์ ํ์ ์์๊ฐ ํฌํจ๋์ด ์๋ ์์์๋ง ์ ์ฉํ ์ ์์ต๋๋ค. container ์ ํ์ amp-img ํ๊ทธ์ ํธํ๋์ง ์๊ธฐ ๋๋ฌธ์ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.
container ์ ํ์ ์ถ์ ํ ์ด์ ๋ ๋ฌด์์ผ๊น์? amp-img ํ๊ทธ์ height ์์ฑ์ ์ง์ ํ์ง ์์๊ธฐ ๋๋ฌธ์
๋๋ค. HTML์์๋ ํ์ด์ง์ ์๋ ์์์ ๊ณ ์ ๋ ๋๋น์ ๋์ด๋ฅผ ์ง์ ํจ์ผ๋ก์จ ๋ฆฌํ๋ก์ฐ๋ฅผ ์ค์ผ ์ ์์ต๋๋ค. AMP์์๋ amp-img ์์์ ๊ฐ๋ก ์ธ๋ก ๋น์จ์ ์ฌ์ ์ ๊ฒฐ์ ํ ์ ์๋๋ก ํด๋น ์์์ ๋๋น์ ๋์ด๋ฅผ ์ ์ํด์ผ ํฉ๋๋ค.
๋ค์๊ณผ ๊ฐ์ด <amp-img> ํ๊ทธ์ width ๋ฐ height๋ฅผ ์ถ๊ฐํฉ๋๋ค.
<amp-img src="mountains.jpg" width="266" height="150"></amp-img>
ํ์ด์ง๋ฅผ ์๋ก๊ณ ์นจํ๊ณ ๊ฒ์ฌ๊ธฐ๋ฅผ ํ์ธํฉ๋๋ค. ๋ ์ด์ ์ค๋ฅ๊ฐ ํ์๋์ง ์์์ผ ํฉ๋๋ค.
์ด์ AMP ๋ฌธ์๊ฐ ์ ํจํด์ก์ต๋๋ค. ํ์ง๋ง ํ์ด์ง์์ ์ด๋ฏธ์ง ์์น๊ฐ ์ด์ํ์ฌ ์ด๋ฏธ์ง๊ฐ ๋ฉ์ ธ ๋ณด์ด์ง ์์ต๋๋ค. amp-img์ ๋์ด์ ๋๋น๋ฅผ ์ง์ ํ๋ฉด ๊ธฐ๋ณธ์ ์ผ๋ก AMP๊ฐ ์ฌ์ฉ์๊ฐ ์ง์ ํ ๊ฐ์ผ๋ก ํฌ๊ธฐ๋ฅผ ์กฐ์ ํฉ๋๋ค. ํ์ง๋ง AMP์์ ์ด๋ค ํ๋ฉด์ด๋ ํ์ด์ง ํฌ๊ธฐ์ ๋ฐ์ํ์ฌ ์ด๋ฏธ์ง๋ฅผ ์๋ง๊ฒ ๋๋ ค์ค๋ค๋ฉด ์ข์ง ์์๊น์?
AMP๋ ์ฌ์ฉ์๊ฐ ์ง์ ํ ๋๋น์ ๋์ด์ ๋ฐ๋ผ ํด๋น ์์์ ๊ฐ๋ก ์ธ๋ก ๋น์จ์ ๊ณ์ฐํ ์ ์์ต๋๋ค. ์ด๋ฅผ ํตํด AMP ๋ ์ด์์ ์์คํ
์์๋ ๋ค์ํ ๋ฐฉ๋ฒ์ผ๋ก ์์๋ฅผ ๋ฐฐ์นํ๊ณ ํฌ๊ธฐ๋ฅผ ์กฐ์ ํฉ๋๋ค. layout ์์ฑ์ AMP์ ์ฌ์ฉ์๊ฐ ์์๋ฅผ ์ด๋ป๊ฒ ๋ฐฐ์นํ๊ณ ๋๋ฆฌ๊ณ ์ถ์ด ํ๋์ง ์๋ ค์ค๋๋ค.
์ด๋ฏธ์ง๋ฅผ ๋๋ฆฌ๊ณ ํฌ๊ธฐ๋ฅผ ์กฐ์ ํ ์ ์๋๋ก ๋ ์ด์์ ์์ฑ์ responsive๋ก ์ค์ ํด ๋ด
์๋ค.
<amp-img
src="mountains.jpg"
layout="responsive"
width="266"
height="150"
></amp-img>
์๋ฃ๋์์ต๋๋ค. ์ด๋ฏธ์ง์ ๊ฐ๋ก ์ธ๋ก ๋น์จ์ด ์๋ง๊ฒ ๋ณ๊ฒฝ๋์์ผ๋ฉฐ ํ๋ฉด ๋๋น์ ๋ง์ถฐ ํ๋ฉด์ ์ฑ์ฐ๊ณ ์์ต๋๋ค.
์ฑ๊ณต์ ๋๋ค.
์ด์ AMP ๋ฌธ์๊ฐ ๋ค์๊ณผ ๊ฐ์ด ์์ฑ๋์ด ์์ด์ผ ํฉ๋๋ค.
<!DOCTYPE html>
<html โก lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="canonical" href="/article.html" />
<link rel="shortcut icon" href="amp_favicon.png" />
<title>News Article</title>
<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
>
<style amp-custom>
body {
width: auto;
margin: 0;
padding: 0;
}
header {
background: Tomato;
color: white;
font-size: 2em;
text-align: center;
}
h1 {
margin: 0;
padding: 0.5em;
background: white;
box-shadow: 0px 3px 5px grey;
}
p {
padding: 0.5em;
margin: 0.5em;
}
</style>
<script async src="https://cdn.ampproject.org/v0.js"></script>
</head>
<body>
<header>News Site</header>
<article>
<h1>Article Name</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam egestas
tortor sapien, non tristique ligula accumsan eu.
</p>
<amp-img
src="mountains.jpg"
layout="responsive"
width="266"
height="150"
></amp-img>
</article>
</body>
</html>
ํ์ด์ง๋ฅผ ์๋ก๊ณ ์นจํ๊ณ ์ฝ์ ์ถ๋ ฅ์ ํ์ธํฉ๋๋ค. ๋ค์ ๋ฉ์์ง๊ฐ ํ์๋์ด์ผ ํฉ๋๋ค.
AMP validation successful.