Meta Title Generator

Meta Title Generator

Craft SEO-friendly titles that increase click-through rates.

Settings

Generated Titles

Your generated titles will appear here.

No titles generated. Try again.

`; return; } resultsContainer.innerHTML = generatedTitles.map(title => `

${title}

`).join(''); } // --- UTILITY FUNCTIONS --- function showNotification(message) { notification.textContent = message; notification.classList.remove('opacity-0'); setTimeout(() => notification.classList.add('opacity-0'), 2000); } function copyToClipboard(text, message) { navigator.clipboard.writeText(text).then(() => showNotification(message)); } // --- PDF GENERATION --- async function generatePdfReport() { if (generatedTitles.length === 0) { showNotification("No titles to generate a report for."); return; } downloadPdfBtn.disabled = true; downloadPdfBtn.textContent = '...'; const nameListItems = generatedTitles.map(name => `
  • ${name}
  • `).join(''); const reportHtml = `

    SEO Title Ideation Sheet

    Generated for Keyword: ${currentKeyword}

    Generated Meta Titles
      ${nameListItems}
    `; const pdfTemplate = document.getElementById('pdf-template'); pdfTemplate.innerHTML = reportHtml; pdfTemplate.classList.remove('invisible'); try { const { jsPDF } = window.jspdf; const canvas = await html2canvas(pdfTemplate.querySelector('.pdf-report-container'), { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(), pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save(`Meta_Titles_${currentKeyword.replace(/\s+/g, '_')}.pdf`); } catch (e) { console.error('PDF Generation Error:', e); } finally { downloadPdfBtn.disabled = false; downloadPdfBtn.textContent = 'Download PDF'; pdfTemplate.classList.add('invisible'); pdfTemplate.innerHTML = ''; } } // --- EVENT LISTENERS --- generateBtn.addEventListener('click', generateTitles); copyAllBtn.addEventListener('click', () => { if (generatedTitles.length > 0) copyToClipboard(generatedTitles.join('\n'), 'All titles copied!'); }); resultsContainer.addEventListener('click', (e) => { if (e.target.classList.contains('copy-title-btn')) { const name = e.target.previousElementSibling.textContent; copyToClipboard(name, 'Title copied!'); } }); downloadPdfBtn.addEventListener('click', generatePdfReport); // --- INITIALIZATION --- generateTitles(); });
    Scroll to Top