Meta Tag Generator
Generated Meta Tags
Copy these tags into the <head> of your page.
Tip: Title should be 50-60 chars, description 120-160 chars. OG image recommended size 1200x630.
`;}
function copyOutput(){
const txt = document.getElementById('output').innerText + '\n' + document.getElementById('jsonld').innerText;
navigator.clipboard.writeText(txt).then(()=>{ alert('Copied to clipboard'); }, ()=>{ alert('Copy failed — please select and copy manually.'); });
}
function downloadMeta(){
const content = '\n' + document.getElementById('output').innerText + '\n' + document.getElementById('jsonld').innerText;
const blob = new Blob([content], {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);
}
function generateJSONLD(){
const sType = document.getElementById('schemaType').value;
const sName = document.getElementById('schemaName').value;
const sUrl = document.getElementById('schemaUrl').value;
const sDesc = document.getElementById('schemaDesc').value;
const schema = {'@context':'https://schema.org','@type':sType,'name':sName,'url':sUrl,'description':sDesc};
Object.keys(schema).forEach(k=>schema[k]==='' && delete schema[k]);
document.getElementById('jsonld').innerText = ``;
}
function resetForm(){
document.getElementById('metaTitle').value='';
document.getElementById('metaDesc').value='';
document.getElementById('metaKeywords').value='';
document.getElementById('metaCanonical').value='';
document.getElementById('metaLocale').value='';
document.getElementById('metaAuthor').value='';
document.getElementById('metaOgImage').value='';
document.getElementById('schemaName').value='';
document.getElementById('schemaUrl').value='';
document.getElementById('schemaDesc').value='';
document.getElementById('output').innerText='';
document.getElementById('jsonld').innerText='';
}
Comments
Post a Comment