์๋ํ๋ ์ค Human ํ ๋ง์์ AMP ํ ๊ธ ๋ฉ๋ด ์ฌ์ฉํ๊ธฐ
๋ชจ๋ฐ์ผ ์ฌ์ฉ์ ๋น์ค์ด ๊ธ๊ฒฉํ ์ฆ๊ฐํ๋ฉด์ AMP(Accelerated Mobile Pages)๋ฅผ ์ฌ์ฉํ๋ ์๋ํ๋ ์ค ๋ธ๋ก๊ทธ๊ฐ ๋ง์์ก์ต๋๋ค. AMP๋ ํ์ด์ง ๋ก๋ฉ ์๋๋ฅผ ํ๊ธฐ์ ์ผ๋ก ๋์ฌ SEO์๋ ๊ธ์ ์ ์ธ ์ํฅ์ ๋ฏธ์น์ง๋ง, ์ผ๋ฐ์ ์ธ ์๋ฐ์คํฌ๋ฆฝํธ ๊ธฐ๋ฅ์ ์ฌ์ฉํ ์ ์๋ค๋ ์ ์ฝ์ด ์์ต๋๋ค.
๊ทธ์ค ๋ชจ๋ฐ์ผ ๋ฉ๋ด ํ ๊ธ ๊ธฐ๋ฅ์ AMP์์ ๊ตฌํํ๊ธฐ ๊น๋ค๋ก์ด ๋ถ๋ถ์ ๋๋ค. ํนํ Human ํ ๋ง๋ฅผ ์ฌ์ฉํ๋ ์๋ํ๋ ์ค ์ฌ์ดํธ์์๋ AMP์ ๋ฉ๋ด์ ํธํ์ฑ์ด ํต์ฌ ์ด์๋ก ๋ ์ค๋ฆ ๋๋ค.
์ด ๊ธ์์๋ AMP ์ง์ ๋ชจ๋ฐ์ผ ๋ฉ๋ด ํ ๊ธ์ Human ํ ๋ง์ ์์ ํ ๊ตฌํํ๋ ๋ฐฉ๋ฒ์ ์ฝ๋์ ํจ๊ป ์์ธํ ์๊ฐํฉ๋๋ค.
AMP๋?
AMP๋ Google์ด ์ฃผ๋ํ๋ ์คํ์์ค ํ๋ ์์ํฌ๋ก, ๋ชจ๋ฐ์ผ ํ๊ฒฝ์์ ์น ํ์ด์ง๋ฅผ ๋ ๋น ๋ฅด๊ฒ ๋ก๋ฉํ๊ธฐ ์ํด ๊ฐ๋ฐ๋์์ต๋๋ค. ๋ถํ์ํ ์์๋ฅผ ์ต์ํํ๊ณ ์บ์ฑ ๊ธฐ์ ์ ํ์ฉํด ์ฌ์ฉ์์๊ฒ ๋น ๋ฅด๊ณ ๊น๋ํ ์น ํ๊ฒฝ์ ์ ๊ณตํฉ๋๋ค.
Human ํ ๋ง์์ AMP ๋ชจ๋ฐ์ผ ๋ฉ๋ด๊ฐ ํ์ํ ์ด์
- ๊ธฐ๋ณธ Human ํ ๋ง๋ AMP์์ ๋ฉ๋ด ํ ๊ธ ๋ฒํผ์ด ์๋ํ์ง ์์
- ์ฌ์ฉ์๊ฐ ๋ฉ๋ด๋ฅผ ํด๋ฆญํด๋ ์๋ฌด ๋ฐ์์ด ์๊ฑฐ๋ ๋ฉ๋ด๊ฐ ํญ์ ํ์๋จ
- AMP ํ๊ฒฝ์์๋ ์ผ๋ฐ JS๋ฅผ ์ฌ์ฉํ ์ ์์ด onClick ๊ธฐ๋ฐ ํ ๊ธ ๊ธฐ๋ฅ์ด ์๋ํ์ง ์์
- ์ฌ์ฉ์ ๊ฒฝํ(UX)๊ณผ SEO ๋ชจ๋ ์ ์ํฅ์ ๋ฐ๊ฒ ๋จ
ํด๊ฒฐ ๋ฐฉ๋ฒ: AMP ์ ์ฉ amp-bind๋ฅผ ํ์ฉํ ํ ๊ธ ๋ฉ๋ด ๊ตฌํ
AMP์์๋ amp-bind๋ผ๋ ๋ฐฉ์์ผ๋ก ์ํ๋ฅผ ๋ณ๊ฒฝํ ์ ์์ต๋๋ค. ์ด๋ฅผ ํ์ฉํด AMP์์๋ ํ ๊ธ ๋ฉ๋ด๋ฅผ ๊ตฌํํ ์ ์์ต๋๋ค.
์ฝ๋ ์ ์ฉ ์์น ์๋ด
- functions.php ๋๋ ํ ๋ง์ ์ปค์คํ ํจ์ ์ถ๊ฐํ ์ ์๋ ๊ณณ์ ์๋ PHP ์ฝ๋๋ฅผ ์ฝ์
- CSS๋ style.css ๋๋ AMP ์คํ์ผ์ด ํ์ฉ๋ ํ ๋ง์style amp-custom ๋ด๋ถ์ ์ฝ์
- AMP ์คํฌ๋ฆฝํธ๋ head ํ๊ทธ ์์ ์ฝ์
Step 1: PHP ํจ์๋ก ๋ฉ๋ด ๋ฒํผ + ๋ฉ๋ด ์ถ๋ ฅ
functions.php์ ์๋ ์ฝ๋๋ฅผ ์ถ๊ฐํ์ธ์!. ๋ฉ๋ด ๋งํฌ๋ง ๋ณ๊ฒฝํด์ ๊ทธ๋๋ก ์ฌ์ฉํ๋ฉด ๋ฉ๋๋ค.
if ( !function_exists( 'hu_print_mobile_btn' ) ) {
function hu_print_mobile_btn() {
?>
<!-- ๋ฉ๋ด ํ ๊ธ ๋ฒํผ -->
<button id="menu-toggle"
class="ham__navbar-toggler-two"
on="tap:AMP.setState({ navMenuToggledOn: !navMenuToggledOn })"
[class]="'ham__navbar-toggler-two ' + (navMenuToggledOn ? 'active' : '')"
aria-expanded="false"
[aria-expanded]="navMenuToggledOn ? 'true' : 'false'">
<span class="ham__navbar-span-wrapper">
<span class="line line-1"></span>
<span class="line line-2"></span>
<span class="line line-3"></span>
</span>
</button>
<!-- ๋ฉ๋ด ๋ณธ์ฒด -->
<div class="nav-container">
<nav class="nav" [class]="navMenuToggledOn ? 'nav show' : 'nav'">
<div class="nav-wrap container">
<ul class="nav container-inner group mobile-search">
<li>
<form role="search" method="get" class="search-form" action="https://qcai.kr/amp" target="_top">
<label>
<span class="screen-reader-text">๊ฒ์:</span>
<input type="search" class="search-field" placeholder="๊ฒ์ …" name="s">
</label>
<input type="submit" class="search-submit" value="๊ฒ์">
</form>
</li>
</ul>
<ul id="menu-menu" class="nav container-inner group">
<li class="menu-item"><a href="๋งํฌ1">๋ฉ๋ด1</a></li>
<li class="menu-item"><a href="๋งํฌ2">๋ฉ๋ด2</a></li>
<li class="menu-item"><a href="๋งํฌ3">๋ฉ๋ด3</a></li>
<li class="menu-item"><a href="๋งํฌ4">๋ฉ๋ด4</a></li>
</ul>
</div>
</nav>
</div>
<?php
}
}
์ด ์ฝ๋๋ ์๋ํ๋ ์ค ํ ๋ง์ functions.php ํ์ผ์ ๋ฃ์ด์ผ ํฉ๋๋ค.
add_theme_support(
'amp',
array(
'nav_menu_toggle' => array(
'nav_container_id' => 'nav-mobile', // ๋ฉ๋ด ์ ์ฒด ๊ฐ์ธ๋ div์ ID
'nav_container_toggle_class'=> 'expanded', // ๋ฉ๋ด๊ฐ ์ด๋ฆด ๋ ์ถ๊ฐ๋ ํด๋์ค
'menu_button_id' => 'ham__navbar-span-wrapper', // ๋ฒํผ ID
'menu_button_toggle_class' => 'active', // ๋ฒํผ ํ์ฑํ์ ์ถ๊ฐ๋ ํด๋์ค
),
)
);
QCAI.KR ์ ์ฉ๋ ํ ๋ง ๋ณด๊ธฐ
Step 2: CSS๋ก ๋ฉ๋ด ํ์ ์ ์ด
AMP์์๋ display: none / display: block ์ ํ์ ํด๋์ค ๊ธฐ๋ฐ์ผ๋ก ์กฐ์ํฉ๋๋ค.
style.css ๋๋ AMP ์คํ์ผ ์์ญ์ ์๋ ์คํ์ผ์ ์ถ๊ฐํ์ธ์.
๊ฒฝ๋ก:
wp-content/themes/hueman/assets/front/css
์์ ๋์ ํ์ผ:
main.min.css
๊ธฐ์กด CSS๋ฅผ ์ง์ ์์ (๋๋ ์ญ์ )ํด๋ ๋์ง๋ง, ์์ ์ด ๋ฒ๊ฑฐ๋กญ๋ค๋ฉด ์๋์ ์ ๊ณต๋ ํ์ผ๋ก ๋ฎ์ด์ฐ๊ธฐํด๋ ๋ฉ๋๋ค.
๋จ, ๋ฐ๋์ ๊ธฐ์กด ํ์ผ์ ๋ฐฑ์
ํด๋๋ ๊ฒ์ด ์ค์ํฉ๋๋ค.
#footer .nav-container .nav,#header .nav-container .nav {
display: none
}
.nav-container .nav ์ฝ๋์ญ์
#footer .nav-container .nav {
display: none
}
์๋ก์ด CSS๋ฅผ ์ถ๊ฐํฉ๋๋ค.
/* ๋ฉ๋ด ๊ธฐ๋ณธ ์จ๊น */
.nav {
display: none;
}
/* AMP ์ํ ๋ณ๊ฒฝ ์ ๋ณด์ด๊ฒ */
.nav.show {
display: block;
}
Step 3: AMP ์คํฌ๋ฆฝํธ head์ ์ฝ์
header.php ๋๋ AMP ๋ฌธ์ head์ ์๋ ์คํฌ๋ฆฝํธ๋ฅผ ์ถ๊ฐํ์ธ์: ํ์ํ ๊ฒฝ์ฐ.
<script async custom-element="amp-bind" src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script>
SEO ๊ด์ ์์ AMP ๋ฉ๋ด์ ์ค์์ฑ
- ํ์ด์ง ์ฒด๋ฅ์๊ฐ ์ฆ๊ฐ: ์ฌ์ฉ์๊ฐ ์ํ๋ ์นดํ ๊ณ ๋ฆฌ๋ฅผ ๋ ์ฝ๊ฒ ํ์ ๊ฐ๋ฅ
- ๊ตฌ์กฐํ๋ ๋ด๋น๊ฒ์ด์ ์ Googlebot์ด ์ฌ์ดํธ ๊ตฌ์กฐ๋ฅผ ๋ ์ ์ดํดํ๊ฒ ๋์
- ๋น ๋ฅธ ๋ก๋ฉ + ๋ ผ๋ฆฌ์ ๋ฉ๋ด ๊ตฌ์กฐ๋ก Core Web Vitals ๊ฐ์
- ๋ชจ๋ฐ์ผ ์ฌ์ฉ์ ์ดํ๋ฅ ๊ฐ์, ์ด๋ ๊ฒฐ๊ตญ ๊ฒ์์์ง ์์์๋ ์ํฅ
์๋ํ๋ ์ค์ Human ํ ๋ง์์๋ AMP ์์ ๋์์ด ๊ฐ๋ฅํฉ๋๋ค. ์ต๊ทผ ๋ช์น ํ ์คํธ๋ฅผ ํด๋ณด๊ณ ์์ผ๋ฉด ํน๋ณํ๊ฒ ๋ง์ด ์์ ํ ๋ถ๋ถ ์์ด๋ ๋ช๊ฐ์ง๋ง ์์ ์ ํ๊ฒ ๋๋ฉด ์ถฉ๋ถ AMP๋ธ๋ก๊ทธ๋ก ์ต์ ํ๊ฐ ๊ฐ๋ฅํฉ๋๋ค. ์ฃผ ๋ฌธ์ ์ ํต์ฌ์ amp-bind๋ฅผ ํตํด ์ํ๋ฅผ ๊ด๋ฆฌํ๊ณ , ํ ๊ธ ๋ฒํผ๊ณผ ๋ฉ๋ด๋ฅผ AMP ๋ฐฉ์์ผ๋ก ์ฐ๊ฒฐํ๋ ๊ฒ์ ๋๋ค. ์ฌ์ฉ์ ๊ฒฝํ๊ณผ SEO๋ฅผ ๋ชจ๋ ๋ง์กฑ์ํค๋ AMP ๋ชจ๋ฐ์ผ ๋ฉ๋ด, ์ง๊ธ ๋ฐ๋ก ์ ์ฉํด ์ฌ์ฉํด ๋ณด์ธ์.