Inputs

Output


      

Advanced Options

Tip: Paste the output inside your <head> tag.

'; }; function buildMeta(){ const title = document.getElementById('title').value.trim(); const summary = document.getElementById('summary').value.trim(); const topic = document.getElementById('topic').value.trim(); const canonical = document.getElementById('canonical').value.trim(); const site = document.getElementById('site').value.trim(); const author = document.getElementById('author').value.trim(); const image = document.getElementById('image').value.trim(); const lang = document.getElementById('lang').value; const index = document.getElementById('index').checked; const follow = document.getElementById('follow').checked; const includeKeywords = document.getElementById('includeKeywords').checked; const includeJsonLd = document.getElementById('includeJsonLd').checked; const err = document.getElementById('err'); const out = document.getElementById('out'); err.style.display = 'none'; err.textContent = ''; out.textContent = ''; if (!title){ err.textContent = 'Please enter Page Title.'; err.style.display = ''; return; } const desc = trimSentence(summary || title, 160); const robots = makeRobots(index, follow); const kws = extractKeywords(summary + ' ' + title, topic); const canon = canonical || (site ? (site.replace(/\/$/,'') + '/' + slugify(title)) : ''); const lines = []; lines.push('' + esc(title) + ''); lines.push(''); lines.push(''); lines.push(''); lines.push(''); if (includeKeywords && kws.length) lines.push(''); if (canon) lines.push(''); if (lang) lines.push(''); // Open Graph lines.push(''); lines.push(''); if (canon) lines.push(''); if (site) lines.push(''); if (image) lines.push(''); lines.push(''); // Twitter Cards lines.push(''); lines.push(''); lines.push(''); if (image) lines.push(''); const tw = document.getElementById('twitter').value.trim(); if (tw) lines.push(''); // JSON-LD if (includeJsonLd) lines.push(makeJsonLd({title, description: desc, author, image, lang, site, canonical: canon})); document.getElementById('out').textContent = lines.join('\n'); } document.getElementById('btnGen').addEventListener('click', buildMeta); document.getElementById('btnClear').addEventListener('click', () => { ['title','summary','topic','canonical','site','author','image','twitter'].forEach(id => document.getElementById(id).value=''); document.getElementById('index').checked = true; document.getElementById('follow').checked = true; document.getElementById('lang').value = 'en'; document.getElementById('includeKeywords').checked = true; document.getElementById('includeJsonLd').checked = false; document.getElementById('err').style.display = 'none'; document.getElementById('out').textContent = ''; }); document.getElementById('btnCopy').addEventListener('click', async () => { try { await navigator.clipboard.writeText(document.getElementById('out').textContent || ''); alert('Copied!'); } catch(e){ alert('Copy failed'); } }); document.getElementById('btnDownload').addEventListener('click', () => { const content = document.getElementById('out').textContent || ''; const html = '\n\n' + content + '\n'; const blob = new Blob([html], {type:'text/html'}); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'meta-tags.html'; document.body.appendChild(a); a.click(); a.remove(); URL.revokeObjectURL(url); });