section of your HTML document, ideally near the top. Place and meta description near the top, followed by Open Graph tags, Twitter Card tags, then other technical tags (viewport, charset, robots, canonical)."}},{"@type":"Question","name":"What is the ideal meta description length?","acceptedAnswer":{"@type":"Answer","text":"Google typically displays 150-160 characters of meta description on desktop and around 120 characters on mobile. Keep your description between 120-160 characters to maximize visibility on both screen sizes. The tool shows a live character counter with color-coded feedback."}},{"@type":"Question","name":"Do I need both Open Graph and Twitter Card tags?","acceptedAnswer":{"@type":"Answer","text":"Yes. Open Graph tags (og:*) are used by Facebook, LinkedIn, Discord, Slack, WhatsApp, and many other platforms. Twitter Card tags (twitter:*) are used by Twitter/X. Twitter falls back to OG tags if Twitter Card tags are missing, but providing both ensures the best preview on every platform."}},{"@type":"Question","name":"Is the meta tag generator free and private?","acceptedAnswer":{"@type":"Answer","text":"Yes. This tool is 100% free, requires no signup, and runs entirely in your browser. No page data, meta tags, or analytics are sent to any server — everything is generated locally on your device."}}]}</script> <link rel="alternate" hreflang="en" href="https://tools.gamezipper.com/dev/meta-tag-generator.html"> <link rel="alternate" hreflang="zh" href="https://tools.gamezipper.com/zh/dev/meta-tag-generator.html"> <link rel="alternate" hreflang="x-default" href="https://tools.gamezipper.com/dev/meta-tag-generator.html"> <script>localStorage.setItem('gz-lang','zh');</script> </head> <body> <div class="gz-container"> <div class="gz-tool-header"> <h1 id="title"></h1> <p class="desc" id="desc"></p> </div> <ins class="adsbygoogle gz-ad-slot-top" data-ad-client="ca-pub-8346383990981353" data-ad-slot="1099212472"></ins> <script>(adsbygoogle=window.adsbygoogle||[]).push({})</script> <div class="gz-tool-area"> <div class="meta-wrap"> <div class="meta-form"> <div class="meta-section"> <h3 id="lbl-basic"></h3> <div><label id="lbl-title">Title</label><input id="titleInput" type="text" maxlength="200" placeholder="My Awesome Page"></div> <div class="char-count" id="titleCount"></div> <div style="margin-top:8px"><label id="lbl-desc">Description</label><textarea id="descInput" maxlength="500" placeholder="A short description of your page"></textarea></div> <div class="char-count" id="descCount"></div> <div style="margin-top:8px"><label id="lbl-keywords">Keywords</label><input id="kwInput" type="text" placeholder="keyword1, keyword2, keyword3"></div> <div style="margin-top:8px"><label id="lbl-author">Author</label><input id="authorInput" type="text" placeholder="Your Name"></div> <div style="margin-top:8px"><label id="lbl-canonical">Canonical URL</label><input id="canonicalInput" type="url" placeholder="https://example.com/page"></div> </div> <div class="meta-section"> <h3 id="lbl-og"></h3> <div><label id="lbl-og-type">OG Type</label><select id="ogType"><option value="website">website</option><option value="article">article</option><option value="product">product</option><option value="video.other">video.other</option><option value="music.song">music.song</option><option value="profile">profile</option></select></div> <div style="margin-top:8px"><label id="lbl-og-image">OG Image URL</label><input id="ogImageInput" type="url" placeholder="https://example.com/og.png"></div> <div style="margin-top:8px"><label id="lbl-og-url">OG URL</label><input id="ogUrlInput" type="url" placeholder="https://example.com/page"></div> <div style="margin-top:8px"><label id="lbl-og-site">Site Name</label><input id="ogSiteInput" type="text" placeholder="My Website"></div> <div style="margin-top:8px"><label id="lbl-og-locale">OG Locale</label><select id="ogLocale"><option value="en_US">en_US</option><option value="zh_CN">zh_CN</option><option value="zh_TW">zh_TW</option><option value="ja_JP">ja_JP</option><option value="es_ES">es_ES</option><option value="fr_FR">fr_FR</option><option value="de_DE">de_DE</option><option value="pt_BR">pt_BR</option><option value="ru_RU">ru_RU</option><option value="ar_SA">ar_SA</option></select></div> </div> <div class="meta-section"> <h3 id="lbl-tw"></h3> <div><label id="lbl-tw-card">Twitter Card</label><select id="twCard"><option value="summary">summary</option><option value="summary_large_image">summary_large_image</option><option value="app">app</option><option value="player">player</option></select></div> <div style="margin-top:8px"><label id="lbl-tw-site">Twitter @site</label><input id="twSiteInput" type="text" placeholder="@username"></div> <div style="margin-top:8px"><label id="lbl-tw-creator">Twitter @creator</label><input id="twCreatorInput" type="text" placeholder="@author"></div> <div style="margin-top:8px"><label id="lbl-tw-image">Twitter Image URL</label><input id="twImageInput" type="url" placeholder="https://example.com/tw.png"></div> </div> <div class="meta-section"> <h3 id="lbl-tech"></h3> <div><label id="lbl-robots">Robots</label><select id="robotsSel"><option value="index, follow">index, follow</option><option value="noindex, follow">noindex, follow</option><option value="index, nofollow">index, nofollow</option><option value="noindex, nofollow">noindex, nofollow</option></select></div> <div style="margin-top:8px"><label id="lbl-charset">Charset</label><select id="charsetSel"><option value="UTF-8">UTF-8</option><option value="UTF-16">UTF-16</option><option value="ISO-8859-1">ISO-8859-1</option></select></div> <div style="margin-top:8px"><label id="lbl-color">Theme Color</label><input id="themeColorInput" type="color" value="#4ecdc4" style="height:38px"></div> <div style="margin-top:8px"><label id="lbl-fb-admin">FB Admins</label><input id="fbAdminInput" type="text" placeholder="1234567890"></div> </div> <div class="copy-bar"> <button id="btnCopy"></button> <button id="btnCopyAll"></button> <button id="btnClear"></button> <button id="btnLoad"></button> </div> </div> <div> <h3 id="lbl-output"></h3> <div class="meta-output" id="output"></div> <h3 id="lbl-preview" style="margin-top:18px"></h3> <div class="preview-card" id="serpPreview"> <div class="pv-url" id="pvUrl">https://example.com/page</div> <div class="pv-title" id="pvTitle">My Awesome Page</div> <div class="pv-desc" id="pvDesc">A short description of your page</div> </div> <div class="preview-twitter"> <div class="tw-card"> <div class="tw-img" id="twImgWrap">No image</div> <div> <div class="tw-title" id="twTitle">My Awesome Page</div> <div class="tw-desc" id="twDesc">A short description of your page</div> </div> </div> </div> <div class="info"> <strong id="info-head"></strong> <span id="info-text"></span> </div> </div> </div> </div> <aside class="gz-monetag-slot" style="margin:18px 0;text-align:center;min-height:60px"> <ins class="adsbygoogle gz-explicit-adsense" data-ad-client="ca-pub-8346383990981353" data-ad-slot="11012002" style="display:block"></ins> </aside> <ins class="adsbygoogle gz-ad-slot-bottom" data-ad-client="ca-pub-8346383990981353" data-ad-slot="1099212472" style="display:block"></ins> <script>(adsbygoogle=window.adsbygoogle||[]).push({})</script> <div class="gz-howto"> <h2 id="howto-h"></h2> <ol> <li id="howto-1"></li> <li id="howto-2"></li> <li id="howto-3"></li> <li id="howto-4"></li> </ol> </div> <div class="gz-related"> <h2 id="rel-h"></h2> <div class="gz-related-grid"> <a href="/dev/google-serp-preview.html">Google SERP Preview</a> <a href="/dev/og-meta-generator.html">Open Graph Meta Generator</a> <a href="/dev/twitter-card-generator.html">Twitter Card Generator</a> <a href="/dev/robots-txt-validator.html">Robots.txt Validator</a> <a href="/dev/sitemap-generator.html">Sitemap XML Generator</a> <a href="/dev/json-ld-validator.html">JSON-LD Validator</a> </div> </div> </div> <script> GZI18n.register({ en: { toolTitle: 'Meta Tag Generator', toolDesc: 'Generate complete HTML meta tags for SEO and social sharing — title, description, Open Graph, Twitter Card, robots, canonical, viewport and charset. Live SERP + Twitter preview, one-click copy.', lblBasic: 'Basic SEO Tags', lblOg: 'Open Graph (Facebook, LinkedIn)', lblTw: 'Twitter Card', lblTech: 'Technical Tags', lblOutput: 'Generated Meta Tags', lblPreview: 'Live Preview', btnCopy: 'Copy Output', btnCopyAll: 'Copy All', btnClear: 'Clear', btnLoad: 'Load Example', titleLabel: 'Title', descLabel: 'Description', kwLabel: 'Keywords (comma separated)', authorLabel: 'Author', canonicalLabel: 'Canonical URL', ogTypeLabel: 'OG Type', ogImageLabel: 'OG Image URL', ogUrlLabel: 'OG URL', ogSiteLabel: 'Site Name', ogLocaleLabel: 'OG Locale', twCardLabel: 'Twitter Card Type', twSiteLabel: 'Twitter @site', twCreatorLabel: 'Twitter @creator', twImageLabel: 'Twitter Image URL', robotsLabel: 'Robots', charsetLabel: 'Charset', colorLabel: 'Theme Color', fbAdminLabel: 'FB Admins', infoHead: 'Tip:', infoText: 'Paste these tags inside your <code><head></code> section. Place <code><title></code> and meta description near the top, then Open Graph, Twitter Card, and technical tags.', howtoH: 'How to Use', howto1: 'Fill in your page title, description, keywords, and the URLs for your Open Graph / Twitter images', howto2: 'Pick OG type, Twitter Card type, robots policy and locale from the dropdowns', howto3: 'Watch the live SERP and Twitter card preview update as you type, and the generated code on the right', howto4: 'Click "Copy Output" and paste the tags into the <head> section of your HTML page', relH: 'Related SEO Tools', charOk: '✓ Good length', charWarn: '⚠ Approaching limit', charOver: '✗ Over limit (will be truncated)', copied: '✓ Copied to clipboard', copyFailed: '✗ Copy failed — please select & copy manually', outputEmpty: 'Fill in some fields to generate meta tags...', }, zh: { toolTitle: 'Meta 标签生成器', toolDesc: '一键生成完整的 HTML Meta 标签:标题、描述、关键词、Open Graph、Twitter Card、robots、视口、字符集。实时 SERP + Twitter 预览,一键复制。', lblBasic: '基础 SEO 标签', lblOg: 'Open Graph(Facebook、LinkedIn)', lblTw: 'Twitter 卡片', lblTech: '技术标签', lblOutput: '生成的 Meta 标签', lblPreview: '实时预览', btnCopy: '复制输出', btnCopyAll: '全部复制', btnClear: '清空', btnLoad: '加载示例', titleLabel: '标题', descLabel: '描述', kwLabel: '关键词(逗号分隔)', authorLabel: '作者', canonicalLabel: '规范链接', ogTypeLabel: 'OG 类型', ogImageLabel: 'OG 图片 URL', ogUrlLabel: 'OG URL', ogSiteLabel: '网站名称', ogLocaleLabel: 'OG 语言区域', twCardLabel: 'Twitter 卡片类型', twSiteLabel: 'Twitter @site', twCreatorLabel: 'Twitter @作者', twImageLabel: 'Twitter 图片 URL', robotsLabel: 'Robots', charsetLabel: '字符集', colorLabel: '主题色', fbAdminLabel: 'FB 管理员', infoHead: '提示:', infoText: '将这些标签粘贴到 <code><head></code> 节中。将 <code><title></code> 和元描述放在顶部,然后是 Open Graph、Twitter 卡片和技术标签。', howtoH: '使用方法', howto1: '填写页面标题、描述、关键词以及 Open Graph / Twitter 图片的 URL', howto2: '从下拉菜单中选择 OG 类型、Twitter 卡片类型、robots 策略和语言区域', howto3: '输入时观察右侧的实时 SERP 和 Twitter 卡片预览以及生成的代码', howto4: '点击"复制输出"并将标签粘贴到 HTML 页面的 <head> 节中', relH: '相关 SEO 工具', charOk: '✓ 长度良好', charWarn: '⚠ 接近上限', charOver: '✗ 超出上限(将被截断)', copied: '✓ 已复制到剪贴板', copyFailed: '✗ 复制失败 — 请手动选择并复制', outputEmpty: '填写一些字段以生成 Meta 标签...', } }); const { t } = GZ; const $ = id => document.getElementById(id); const fields = [ ['titleInput','titleLabel'], ['descInput','descLabel'], ['kwInput','kwLabel'], ['authorInput','authorLabel'], ['canonicalInput','canonicalLabel'], ['ogType','ogTypeLabel'], ['ogImageInput','ogImageLabel'], ['ogUrlInput','ogUrlLabel'], ['ogSiteInput','ogSiteLabel'], ['ogLocale','ogLocaleLabel'], ['twCard','twCardLabel'], ['twSiteInput','twSiteLabel'], ['twCreatorInput','twCreatorLabel'], ['twImageInput','twImageLabel'], ['robotsSel','robotsLabel'], ['charsetSel','charsetLabel'], ['fbAdminInput','fbAdminLabel'], ]; const inputs = ['titleInput','descInput','kwInput','authorInput','canonicalInput','ogType','ogImageInput','ogUrlInput','ogSiteInput','ogLocale','twCard','twSiteInput','twCreatorInput','twImageInput','robotsSel','charsetSel','themeColorInput','fbAdminInput']; function esc(s){return (s||'').replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');} function escAttr(s){return (s||'').replace(/"/g,'"');} function build(){ const v = {}; inputs.forEach(id => v[id] = $(id).value.trim()); let html = ''; html += `<meta charset="${escAttr(v.charsetSel || 'UTF-8')}">\n`; html += `<meta name="viewport" content="width=device-width, initial-scale=1">\n`; if (v.themeColorInput) html += `<meta name="theme-color" content="${escAttr(v.themeColorInput)}">\n`; if (v.robotsSel) html += `<meta name="robots" content="${escAttr(v.robotsSel)}">\n`; if (v.authorInput) html += `<meta name="author" content="${escAttr(v.authorInput)}">\n`; if (v.kwInput) html += `<meta name="keywords" content="${escAttr(v.kwInput)}">\n`; if (v.titleInput) html += `<title>${esc(v.titleInput)}\n`; if (v.descInput) html += `\n`; if (v.canonicalInput) html += `\n`; // Open Graph if (v.titleInput || v.descInput) { html += '\n\n'; if (v.ogType) html += `\n`; if (v.titleInput) html += `\n`; if (v.descInput) html += `\n`; if (v.ogUrlInput) html += `\n`; if (v.ogImageInput) html += `\n`; if (v.ogSiteInput) html += `\n`; if (v.ogLocale) html += `\n`; if (v.fbAdminInput) html += `\n`; } // Twitter Card if (v.twCard || v.titleInput || v.descInput) { html += '\n\n'; if (v.twCard) html += `\n`; if (v.twSiteInput) html += `\n`; if (v.twCreatorInput) html += `\n`; if (v.titleInput) html += `\n`; if (v.descInput) html += `\n`; if (v.twImageInput) html += `\n`; if (v.ogImageInput && !v.twImageInput) html += `\n`; } return html; } function update(){ const html = build(); $('output').textContent = html || t('outputEmpty'); // SERP preview $('pvUrl').textContent = $('canonicalInput').value || $('ogUrlInput').value || 'https://example.com/page'; $('pvTitle').textContent = $('titleInput').value || 'My Awesome Page'; $('pvDesc').textContent = $('descInput').value || 'A short description of your page'; // Twitter preview $('twTitle').textContent = $('titleInput').value || 'My Awesome Page'; $('twDesc').textContent = $('descInput').value || 'A short description of your page'; const twImg = $('twImageInput').value || $('ogImageInput').value; const twImgWrap = $('twImgWrap'); if (twImg) { twImgWrap.innerHTML = ``; } else { twImgWrap.textContent = 'No image'; } // Char counts const tlen = $('titleInput').value.length; const dlen = $('descInput').value.length; const tc = $('titleCount'); tc.textContent = `${tlen} / 60 ` + (tlen > 60 ? t('charOver') : tlen > 50 ? t('charWarn') : t('charOk')); tc.className = 'char-count ' + (tlen > 60 ? 'char-over' : tlen > 50 ? 'char-warn' : 'char-ok'); const dc = $('descCount'); dc.textContent = `${dlen} / 160 ` + (dlen > 160 ? t('charOver') : dlen > 150 ? t('charWarn') : t('charOk')); dc.className = 'char-count ' + (dlen > 160 ? 'char-over' : dlen > 150 ? 'char-warn' : 'char-ok'); } function copyOutput(){ const txt = $('output').textContent; if (!txt || txt === t('outputEmpty')) return; navigator.clipboard.writeText(txt).then(() => { const b = $('btnCopy'); const orig = b.textContent; b.textContent = t('copied'); setTimeout(() => b.textContent = orig, 1500); }).catch(() => { const b = $('btnCopy'); const orig = b.textContent; b.textContent = t('copyFailed'); setTimeout(() => b.textContent = orig, 2000); }); } function clearAll(){ inputs.forEach(id => { if ($(id).tagName === 'SELECT') $(id).selectedIndex = 0; else $(id).value = ''; }); $('themeColorInput').value = '#4ecdc4'; update(); } function loadExample(){ $('titleInput').value = 'Free Online Meta Tag Generator — GameZipper Tools'; $('descInput').value = 'Generate complete HTML meta tags for SEO and social sharing. Title, description, Open Graph, Twitter Card — live preview, copy & paste.'; $('kwInput').value = 'meta tag generator, meta tags, SEO, open graph, twitter card'; $('authorInput').value = 'GameZipper'; $('canonicalInput').value = 'https://tools.gamezipper.com/dev/meta-tag-generator.html'; $('ogType').value = 'website'; $('ogImageInput').value = 'https://tools.gamezipper.com/shared/og-image.png'; $('ogUrlInput').value = 'https://tools.gamezipper.com/dev/meta-tag-generator.html'; $('ogSiteInput').value = 'GameZipper Tools'; $('ogLocale').value = 'en_US'; $('twCard').value = 'summary_large_image'; $('twSiteInput').value = '@gamezipper'; $('twCreatorInput').value = '@gamezipper'; $('twImageInput').value = 'https://tools.gamezipper.com/shared/og-image.png'; $('robotsSel').value = 'index, follow'; $('charsetSel').value = 'UTF-8'; $('themeColorInput').value = '#4ecdc4'; $('fbAdminInput').value = ''; update(); } // Init fields.forEach(([id, lbl]) => { const el = $(id); const lblEl = document.querySelector(`label[for="${id}"]`) || $(lbl); if (lblEl) lblEl.textContent = t(lbl); }); inputs.forEach(id => { $(id).addEventListener('input', update); $(id).addEventListener('change', update); }); $('btnCopy').addEventListener('click', copyOutput); $('btnCopyAll').addEventListener('click', copyOutput); $('btnClear').addEventListener('click', clearAll); $('btnLoad').addEventListener('click', loadExample); loadExample();