Thuta Learning
HTML
AdvancedWeb Developmentအခြေခံ

SEO & Meta Tags

HTMLသင်ခန်းစာ 2820 မိနစ်

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Page တိုင်းအတွက် ထူးခြားပြီး တိုတောင်းတဲ့ <title> နဲ့ meta description ရေးနိုင်ဖို့
  • viewport နဲ့ charset meta tag တွေ မပါရင် ဘာဖြစ်လဲ ရှင်းပြနိုင်ဖို့
  • URL ထပ်နေတဲ့ page တွေအတွက် rel="canonical" နဲ့ index မလုပ်စေချင်တဲ့ page အတွက် robots noindex ကို သုံးနိုင်ဖို့
  • Social share preview အတွက် Open Graph tag တွေ ထည့်နိုင်ပြီး metadata က content ကောင်းကို အစားမထိုးကြောင်း နားလည်ဖို့

ရိုးရိုးလေး ရှင်းပြမယ်

ရိုးရိုးလေး ရှင်းရရင်

<head> ကို စာအုပ်ရဲ့ မျက်နှာဖုံးနဲ့ နောက်ကျော စာလို မြင်ကြည့်ပါ။ Page ပေါ်မှာ မမြင်ရပေမယ့် browser tab ထဲက စာ၊ Google ရလဒ်ထဲက ခေါင်းစဉ်နဲ့ အကျဉ်းချုပ်၊ Facebook ဒါမှမဟုတ် Telegram မှာ link share လုပ်တဲ့အခါ ပေါ်လာတဲ့ card တွေ အားလုံး ဒီကနေ လာပါတယ်။

Title နဲ့ description က လူတွေ link ကို နှိပ်မလား မနှိပ်ဘူးလား ဆုံးဖြတ်တဲ့ "ကြော်ငြာ စာတို" လိုပါပဲ။ viewport tag ကတော့ ဖုန်းကို "ဒီ page ကို ဖုန်း screen အကျယ်နဲ့ ပြပါ" လို့ ပြောပါတယ် — မပါရင် desktop page ကို သေးသေးလေး ချုံ့ပြပြီး စာတွေ ဖတ်မရအောင် သေးသွားပါတယ်။

Problem → Why → Solution

ပြဿနာ: page တိုင်း title တူပြီး keyword တွေ ဖြည့်ထားတာ

Website တစ်ခုက page template တစ်ခုတည်းကို page အားလုံးမှာ သုံးလို့ title က "Home" ချည်းပဲ ဖြစ်ပြီး description လည်း အတူတူပါ။ Search ရလဒ်ထဲမှာ ဒီ site ရဲ့ page ဆယ်ခုလုံး "Home" လို့ ပေါ်လို့ ဘယ်ဟာ ဘာလဲ ခွဲမရပါဘူး၊ browser tab ဆယ်ခု ဖွင့်ထားတဲ့ user ကလည်း အတူတူပါပဲ။ Developer က meta keywords ထဲ စကားလုံး ဒါဇင်ချီ ထည့်ပြီး ranking တက်မယ်လို့ မျှော်လင့်ပေမယ့် Google က အဲဒီ tag ကို ranking အတွက် လုံးဝ မသုံးပါဘူး။

every-page-head.html
<head>
  <title>Home</title>
  <meta name="description" content="Welcome to our website.">
  <meta name="keywords" content="html, html tutorial, learn html, free html,
        best html, html course, web, website, coding, programming">
</head>

ဘာကြောင့် ဒါက အလုပ်မလုပ်တာလဲ

Search engine တွေက page တစ်ခုချင်းရဲ့ အကြောင်းအရာကို title, heading နဲ့ မြင်ရတဲ့ content ကနေ နားလည်ပါတယ်။ Title တူနေရင် page တွေကို ခွဲခြားဖို့ အချက်ပြ မရှိတော့ပါဘူး။ Meta keywords ကို ဆယ်စုနှစ်ကျော်ကတည်းက spam အဖြစ် အလွဲသုံးခဲ့ကြလို့ Google က ranking မှာ ထည့်မတွက်ပါဘူး။ Page တစ်ခုချင်းကို ကိုယ်ပိုင် title နဲ့ description ပေးတာက ပိုထိရောက်ပါတယ်။

Core concept: head metadata တစ်ခုချင်းက ဘယ်သူ့ကို ပြောလဲ

<meta charset="utf-8"> က browser ကို byte တွေကို စာလုံးအဖြစ် ဘယ်လို ဖတ်ရမလဲ ပြောပါတယ် — မပါရင် Myanmar စာ၊ emoji၊ © တွေ အမှိုက်စာလုံးတွေ ဖြစ်သွားနိုင်ပါတယ်။ Document ရဲ့ ပထမ 1024 bytes ထဲမှာ ရှိရလို့ <head> ရဲ့ အစမှာ ထားပါ။ <meta name="viewport" content="width=device-width, initial-scale=1"> က mobile browser ကို page ကို စက်ရဲ့ အကျယ်နဲ့ ပြခိုင်းပါတယ်၊ မပါရင် ဖုန်းအများစုက desktop အကျယ် (980px ခန့်) နဲ့ render လုပ်ပြီး ချုံ့ပြပါတယ်။

<title> က browser tab၊ bookmark နဲ့ search ရလဒ်ရဲ့ ခေါင်းစဉ်အဖြစ် အဓိက သုံးပါတယ်။ Page တိုင်း ထူးခြားပါစေ၊ အရေးကြီးတဲ့ စကားလုံးကို ရှေ့မှာ ထားပြီး site နာမည်ကို နောက်မှာ ထားပါ — "Input Types - HTML Tutorial"။ Meta description က search ရလဒ်ထဲက အကျဉ်းချုပ် (snippet) အဖြစ် ပေါ်လေ့ ရှိပေမယ့် search engine က user ရှာတဲ့ စကားလုံးနဲ့ ပိုကိုက်တဲ့ page ထဲက စာကို ရွေးပြီး အစားထိုးနိုင်ပါတယ်။ Character အကန့်အသတ် တိတိကျကျ မရှိပေမယ့် ရှည်ရင် ဖြတ်ပြလို့ စာကြောင်း တစ်ကြောင်း နှစ်ကြောင်းစာ အတိုချုပ်ပါ။

<link rel="canonical" href="..."> က URL အမျိုးမျိုးနဲ့ ရောက်နိုင်တဲ့ page တစ်ခု (ဥပမာ ?ref=facebook ပါတဲ့ URL) အတွက် "ဒီ URL က မူရင်းပါ" လို့ search engine ကို အကြံပြုပါတယ်။ <meta name="robots" content="noindex"> က search ရလဒ်ထဲ မပါစေချင်တဲ့ page (thank-you page, internal search) တွေအတွက်ပါ။ Open Graph tag (og:title, og:description, og:image) တွေက social app တွေမှာ share card ကို ထိန်းချုပ်ပါတယ်။

ဘာသာစကား နှစ်မျိုးနဲ့ ရှိတဲ့ site (ဥပမာ Myanmar နဲ့ English) မှာ <link rel="alternate" hreflang="my" href="..."> လို tag တွေက page ရဲ့ တခြား ဘာသာ version ကို ညွှန်ပြပြီး search engine က user ရဲ့ ဘာသာစကားနဲ့ ကိုက်တဲ့ version ကို ပြနိုင်ပါတယ်။ JSON-LD structured data ကလည်း rating, ဈေးနှုန်း လို အချက်တွေကို စက်ဖတ်လို့ရအောင် ဖော်ပြပေးပေမယ့် page ပေါ်မှာ မြင်ရတဲ့ အချက်အလက်ကနေပဲ ထုတ်ရပါမယ်။

Metadata တွေက page ကို ကောင်းကောင်း ကိုယ်စားပြုအောင် ကူညီပေးရုံပါ။ အသုံးဝင်တဲ့ content၊ heading မှန်မှန်၊ crawl လုပ်လို့ရတဲ့ <a href> link တွေ၊ မြန်တဲ့ page တွေကို အစားမထိုးနိုင်ပါဘူး၊ content နဲ့ မကိုက်တဲ့ metadata ကလည်း user ယုံကြည်မှုကို ပျက်စေပါတယ်။

မှတ်ထားရမယ့် ပုံစံ
  1. charset, viewport: browser အတွက်
  2. title, description: search အတွက်
  3. canonical, robots: crawler အတွက်
  4. og:*: social app အတွက်
  5. Content အစစ်က အဓိက

Tag တစ်ခုချင်းကို "ဒါကို ဘယ်သူ ဖတ်မလဲ" လို့ မေးရင် ဘာထည့်ရမလဲ ရှင်းသွားပါတယ်။

အထွေထွေ ပုံစံ

html
<html lang="language-code">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Specific page topic - Site name</title>
  <meta name="description" content="One or two sentences about this page.">
  <link rel="canonical" href="https://example.com/the-one-true-url">
  <meta property="og:title" content="Title for share cards">
</head>

charset ကို အရင်ဆုံး ထားပြီး viewport၊ ထူးခြားတဲ့ title နဲ့ description၊ canonical နဲ့ Open Graph ကို နောက်က ထည့်ပါတယ်။ Open Graph က name မဟုတ်ဘဲ property attribute ကို သုံးပါတယ်။

Example: tutorial page ရဲ့ အခြေခံ head

ဒီ head မှာ page တိုင်း မဖြစ်မနေ လိုအပ်တဲ့ tag လေးခု ပါပါတယ်။ Page body မှာ ဘာမှ မပေါ်ပေမယ့် browser tab ကို ကြည့်ပြီး DevTools ရဲ့ device toolbar နဲ့ ဖုန်း အရွယ်အစားကို ပြောင်းကြည့်ပါ။

html
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>HTML Tutorial for Beginners</title>
  <meta name="description" content="Learn HTML from basic to practical projects with simple examples.">
</head>

Code ကို တစ်ပိုင်းချင်း ရှင်းပြမယ်

  1. Character set<meta charset="UTF-8">

    Head ရဲ့ ပထမဆုံး tag ဖြစ်လို့ browser က တခြား စာလုံး မဖတ်ခင် UTF-8 ကို သိပါတယ်။ "UTF-8" နဲ့ "utf-8" နှစ်မျိုးလုံး မှန်ပါတယ်။

  2. Viewport<meta name="viewport" content="width=device-width, initial-scale=1.0">

    width=device-width က layout အကျယ်ကို ဖုန်း screen နဲ့ ညီစေပြီး initial-scale=1.0 က zoom မလုပ်ဘဲ စပြပါတယ်။ CSS media query တွေ ဖုန်းမှာ အလုပ်လုပ်ဖို့ ဒီ tag လိုပါတယ်။

  3. Title<title>HTML Tutorial for Beginners</title>

    Tab၊ bookmark နဲ့ search ခေါင်းစဉ် ဖြစ်ပါတယ်။ Site ထဲက တခြား page တွေမှာ "Input Types - HTML Tutorial" လို ကိုယ်ပိုင် title ပေးရပါမယ်။

  4. Description<meta name="description" content="Learn HTML from basic to practical projects with simple examples.">

    Page ရဲ့ အကြောင်းအရာကို စာကြောင်း တစ်ကြောင်းနဲ့ မှန်မှန်ကန်ကန် ပြောထားပါတယ်။ Search engine က snippet အဖြစ် သုံးနိုင်ပေမယ့် အာမခံချက် မရှိပါဘူး။

You should see
Page body မှာ ဘာမှ မပေါ်ပါဘူး။ Browser tab မှာ "HTML Tutorial for Beginners" ပေါ်ပြီး ဖုန်းပေါ်မှာ page ကို စက်ရဲ့ အကျယ်နဲ့ ပြပါတယ်။ Description စာက page ပေါ်မှာ မမြင်ရဘဲ search ရလဒ်မှာ snippet အဖြစ် သုံးနိုင်ပါတယ်။

Social share card အတွက် Open Graph

Link ကို Facebook, LinkedIn, Telegram, Slack လို app တွေမှာ paste လုပ်တဲ့အခါ app က page ရဲ့ head ကို ဖတ်ပြီး card ဆောက်ပါတယ်။ og:image မပါရင် card က image မပါဘဲ ပေါ်တတ်ပြီး og:title မပါရင် <title> ကို fallback အဖြစ် သုံးလေ့ ရှိပါတယ်။ Image URL ကို https:// နဲ့ စတဲ့ absolute URL အဖြစ် ရေးပါ — app တွေက relative path ကို မှန်မှန် မဖြေရှင်းနိုင်တတ်ပါဘူး။

og-tags.html
<meta property="og:type" content="article">
<meta property="og:title" content="Input Types - HTML Tutorial">
<meta property="og:description" content="Pick the right input type for each field.">
<meta property="og:url" content="https://example.com/html/input">
<meta property="og:image" content="https://example.com/img/input-card.png">

လက်တွေ့ project တွေမှာ

Real project တွေမှာ ဘယ်လို သုံးလဲ

Next.js လို framework တွေမှာ page တစ်ခုချင်းက metadata object ဒါမှမဟုတ် function ကနေ title, description, canonical, Open Graph ကို ထုတ်ပေးပြီး CMS ထဲက data ကနေ အလိုလို ဖြည့်ပါတယ်။ ဒါကြောင့် template ထဲမှာ "Home" လို စာ hard-code လုပ်ထားတာမျိုး မဖြစ်ပါဘူး။ Blog ဒါမှမဟုတ် product page တစ်ထောင်ရှိတဲ့ site တွေမှာ description ကို article ရဲ့ excerpt ကနေ ယူပြီး og:image ကို article ရဲ့ cover image ကနေ ယူပါတယ်။

Launch မလုပ်ခင် team တွေက Google Search Console နဲ့ index ဖြစ်မဖြစ် စစ်ပြီး social platform တွေရဲ့ link preview debugger tool တွေနဲ့ share card ကို စမ်းပါတယ်။ Staging site ကို search ရလဒ်ထဲ မပေါ်အောင် noindex ထည့်ထားပြီး production ကို deploy လုပ်တဲ့အခါ ဖြုတ်ဖို့ မေ့သွားတာက တကယ် ဖြစ်တတ်တဲ့ ပြဿနာပါ — ဒါကြောင့် release checklist ထဲ ထည့်ထားပါ။ Team အများအပြားက production HTML ထဲမှာ noindex ပါနေရင် build ကို fail ဖြစ်စေတဲ့ automated test တစ်ခုပါ ထည့်ထားကြပါတယ်။

အမှားများ

အဖြစ်များတဲ့ အမှားတွေ

1. Meta keywords နဲ့ မမြင်ရတဲ့ keyword stuffing

Meta keywords ကို Google က ranking မှာ မသုံးပါဘူး။ CSS နဲ့ ဖျောက်ထားတဲ့ စာ ဒါမှမဟုတ် title ထဲ keyword ထပ်ခါထပ်ခါ ထည့်တာက spam policy ကို ချိုးဖောက်နိုင်ပြီး user ကိုလည်း ရှုပ်ထွေးစေပါတယ်။

2. Page အားလုံး title နဲ့ description တူတာ

Template ထဲမှာ hard-code လုပ်ထားတဲ့ title က search ရလဒ်နဲ့ browser tab တွေမှာ page တွေကို ခွဲမရအောင် လုပ်ပါတယ်။ Page တစ်ခုချင်းရဲ့ အဓိက အကြောင်းအရာကို title ရဲ့ ရှေ့မှာ ထားပါ။

3. Viewport မထည့်တာ ဒါမှမဟုတ် zoom ကို ပိတ်တာ

Viewport မပါရင် ဖုန်းပေါ်မှာ စာလုံးတွေ သေးလွန်းပါတယ်။ ပြောင်းပြန်အနေနဲ့ maximum-scale=1 ဒါမှမဟုတ် user-scalable=no ထည့်ရင် အမြင်အားနည်းသူတွေ zoom မလုပ်နိုင်လို့ accessibility ပြဿနာ ဖြစ်ပါတယ်။

4. og:image ကို relative path နဲ့ ရေးတာ

content="/img/card.png" လို relative path ကို social app တွေက မှန်မှန် မဖြေရှင်းနိုင်တတ်လို့ share card မှာ ပုံ မပေါ်ပါဘူး။ https:// နဲ့ စတဲ့ URL အပြည့်ကို သုံးပါ။

Best Practices

အကောင်းဆုံး အလေ့အကျင့်များ

  • charset ကို <head> ရဲ့ ပထမဆုံး tag အဖြစ် ထားပါ။
  • Title နဲ့ description ကို page ပေါ်က မြင်ရတဲ့ content နဲ့ ကိုက်အောင် ရေးပါ။
  • Deploy တိုင်း robots noindex မကျန်ခဲ့ကြောင်း စစ်ပါ။

Mini challenge

Mini challenge: product page ရဲ့ head

Online shop ထဲက "Handwoven Shan Bag" product page အတွက် <head> အပြည့်အစုံ ရေးပါ။ Body မှာ product နာမည် heading တစ်ခုပဲ ထည့်ပါ။

  • <html lang="en">, charset နဲ့ viewport
  • Product နာမည်ကို ရှေ့ထားပြီး shop နာမည်ကို နောက်ထားတဲ့ title
  • Product ကို မှန်ကန်စွာ ဖော်ပြတဲ့ စာကြောင်း တစ်ကြောင်း နှစ်ကြောင်း description
  • https://shop.example.com/bags/shan-bag ကို ညွှန်တဲ့ canonical နဲ့ og:title, og:image, og:url
shan-bag.html
<!doctype html>
<html>
<head>
  <!-- TODO: character set first -->
  <!-- TODO: mobile viewport -->
  <!-- TODO: unique title: product first, shop name last -->
  <!-- TODO: meta description -->
  <!-- TODO: canonical link and Open Graph tags (absolute URLs) -->
</head>
<body>
  <!-- TODO: product name as the page heading -->
</body>
</html>

ရလဒ်: Page မှာ "Handwoven Shan Bag" heading တစ်ခုပဲ ပေါ်ပြီး tab မှာ "Handwoven Shan Bag - Golden Loom Shop" ပေါ်ပါတယ်။ document.querySelector('link[rel=canonical]').href က https://shop.example.com/bags/shan-bag ကို ပြန်ပေးပါတယ်။

အရိပ်အမြွက် ကြည့်ရန်

Open Graph tag တွေက name မဟုတ်ဘဲ property="og:..." ကို သုံးပါတယ်။ og:image နဲ့ og:url ကို https:// နဲ့ စတဲ့ URL အပြည့် ရေးပါ။

အဖြေ ကြည့်ရန်
shan-bag.html
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Handwoven Shan Bag - Golden Loom Shop</title>
  <meta name="description"
        content="A cotton shoulder bag handwoven in Shan State, with a zip pocket.">
  <link rel="canonical" href="https://shop.example.com/bags/shan-bag">
  <meta property="og:type" content="website">
  <meta property="og:title" content="Handwoven Shan Bag">
  <meta property="og:url" content="https://shop.example.com/bags/shan-bag">
  <meta property="og:image" content="https://shop.example.com/img/shan-bag.jpg">
</head>
<body>
  <h1>Handwoven Shan Bag</h1>
</body>
</html>

Quick Quiz 1 / 3

<meta name="keywords" content="..."> ထဲ စကားလုံး အများကြီး ထည့်ရင် Google ranking ကို ဘာဖြစ်စေမလဲ။

Quick Quiz 2 / 3

Product page တစ်ခုကို /bags/shan-bag နဲ့ /bags/shan-bag?ref=facebook နှစ်မျိုးနဲ့ ရောက်နိုင်ပါတယ်။ ဘာထည့်သင့်လဲ။

Quick Quiz 3 / 3

Viewport meta tag မပါတဲ့ responsive page ကို ဖုန်းမှာ ဖွင့်ရင် ဘာဖြစ်တတ်လဲ။

မှတ်ထားရမယ့် အချက်များ

  • charset ကို ပထမဆုံး ထားပြီး viewport က ဖုန်းမှာ page ကို စက်ရဲ့ အကျယ်နဲ့ ပြစေပါတယ်။
  • Page တိုင်းမှာ ထူးခြားတဲ့ title နဲ့ မှန်ကန်တဲ့ description ပေးပါ၊ meta keywords က ranking ကို မကူညီပါ။
  • Canonical က duplicate URL တွေကို စုစည်းပြီး robots noindex က page ကို search အပြင်မှာ ထားပါတယ်။
  • Open Graph က share card ကို ထိန်းချုပ်ပြီး metadata က content ကောင်းကို အစားမထိုးပါဘူး။

HTML Living Standard — Document Metadata — WHATWG

နောက်ဆုံးပြင်ဆင်ရက်

Progress ကို ဤ browser (ဤစက်) တွင်သာ သိမ်းထားပါသည်။ အခြားစက်များနှင့် sync မလုပ်ပါ။

ဤသင်ခန်းစာတွင် အမှားတွေ့ပါက အကြောင်းကြားရန်သင့် email app ကို ဤသင်ခန်းစာလိပ်စာ ဖြည့်ပြီးသားဖြင့် ဖွင့်ပေးပါမည် — သင်ကိုယ်တိုင် ပို့မှသာ ပို့မည်ဖြစ်သည်။

SEO & Meta Tags | Thuta Learning