← Back to HTML Course | Chapter 10: Reference & Interview Prep | Lesson 6 of 20

HTML मेटा टैग्स

Meta tags head section में रहते हैं और users के लिए invisible होते हैं लेकिन सर्च इंजनों और social media platforms के लिए बेहद ज़रूरी होते हैं। ये Google को बताते हैं कि आपका page किस बारे में है और Facebook या Twitter को बताते हैं कि जब कोई आपका link share करे तो कौन-सी image और title दिखानी है।
Syntax
markup
<meta name="name" content="value">
<meta charset="UTF-8">
<meta http-equiv="header" content="value">

बेसिक मेटा टैग्स

description meta tag सर्च इंजनों को बताता है कि आपका page किस बारे में है। यह Google search results में आपके page title के नीचे snippet के रूप में दिखता है। description को लगभग 160 characters के अंदर रखने से यह search results में कटने से बचता है।

Note:
  • search results में सबसे अच्छे display के लिए meta descriptions को 150-160 characters के बीच रखें।
  • Accepted attributes:
  • name — description | keywords | author | robots | viewport | theme-color
  • content — value for that name
  • charset — utf-8
  • http-equiv — refresh | content-security-policy | content-type
Warning: अलग-अलग pages पर duplicate meta descriptions सर्च इंजनों को confuse करती हैं और rankings को नुकसान पहुँचाती हैं।

उदाहरण: Basic Meta Tags

markup
<meta name="description" content="Learn HTML basics with simple examples.">

ओपन ग्राफ मेटा टैग्स

Open Graph tags यह control करते हैं कि आपका page Facebook, LinkedIn, या WhatsApp पर share होने पर कैसा दिखे। इनके बिना platforms अंदाज़ा लगाकर कुछ दिखाते हैं और अक्सर गलत हो जाता है।

publish करने से पहले link debugger से अपने Open Graph tags test करने से किसी शर्मनाक टूटे हुए preview card से बचा जा सकता है।

Note:
  • हमेशा og:image शामिल करें — images वाले posts पर काफी ज़्यादा engagement मिलता है।
  • Accepted attributes:
  • property — og:title | og:description | og:image | og:url | og:type
  • content — value for that property
Warning: og:image एक https वाला absolute URL होना चाहिए — relative paths काम नहीं करते।

उदाहरण: Open Graph Meta Tags

markup
<meta property="og:title" content="My Page">
<meta property="og:image" content="https://example.com/preview.jpg">

व्यूपोर्ट मेटा टैग

viewport meta tag यह control करता है कि mobile devices पर page कैसे scale हो -- इसके बिना, phones page को fixed desktop width पर render करके फिर उसे छोटा कर देते हैं, जिससे text और buttons इस्तेमाल करने में बहुत छोटे हो जाते हैं।

Note:
  • Accepted attributes:
  • name — viewport
  • content — width=device-width | initial-scale=1 | minimum-scale | maximum-scale | user-scalable=yes|no

उदाहरण: Viewport Meta Tag

markup
<meta name="viewport" content="width=device-width, initial-scale=1">

कैरेक्टर एनकोडिंग मेटा टैग

charset meta tag browser को बताता है कि page का text decode करते समय कौन-सा character encoding इस्तेमाल करना है, और UTF-8 standard choice है क्योंकि यह लगभग हर भाषा के letters और symbols सही तरीके से display करता है।

Note:
  • Accepted attributes:
  • charset — utf-8

उदाहरण: Character Encoding Meta Tag

markup
<meta charset="UTF-8">

Author और Keywords मेटा टैग्स

author meta tag बताता है कि किसी page को किसने लिखा या maintain किया है, और keywords meta tag कभी शुरुआती सर्च इंजनों द्वारा इस्तेमाल होता था, लेकिन Google जैसे आधुनिक इंजन अब इसे पूरी तरह ignore करते हैं और असल page content पर निर्भर रहते हैं।

Note:
  • Accepted attributes:
  • name — author | keywords
  • content — free text (comma-separated for keywords)

उदाहरण: Author and Keywords Meta Tags

markup
<meta name="author" content="Jane Doe">
<meta name="keywords" content="html, tutorial, web">
Live Example
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.