hreflang Tag Checker

hreflang Tag Checker

Paste your page's HTML source to validate your hreflang implementation.

1. Paste HTML Source Code

Analysis results will appear here.

No hreflang tags were found in the provided HTML.

`; } else { analysis.details.forEach(detail => { let issuesHtml = detail.issues.map(issue => { const color = issue.type === 'error' ? 'red' : 'yellow'; return `
  • ${issue.message}
  • `; }).join(''); const hasIssues = detail.issues.length > 0; const statusColor = hasIssues ? (detail.issues.some(i => i.type === 'error') ? 'red' : 'yellow') : 'green'; const statusIcon = hasIssues ? (statusColor === 'red' ? '✘' : '⚠') : '✔'; reportContainer.innerHTML += `
    ${statusIcon}

    ${detail.href}

    hreflang="${detail.hreflang}"

      ${issuesHtml}
    `; }); } } async function generatePdf() { if (!lastAnalysis.details) return; document.getElementById('pdf-date').textContent = new Date().toLocaleDateString(); document.getElementById('pdf-kpis').innerHTML = `

    Tags Found

    ${lastAnalysis.tagsFound}

    Errors

    ${lastAnalysis.errorCount}

    Warnings

    ${lastAnalysis.warningCount}

    `; let detailsHtml = lastAnalysis.globalIssues.map(i => `

    ${i.type.toUpperCase()}: ${i.message}

    `).join(''); detailsHtml += lastAnalysis.details.map(d => { let issues = d.issues.map(i => `
  • ${i.type.toUpperCase()}: ${i.message}
  • `).join(''); return `

    URL: ${d.href}

    hreflang: "${d.hreflang}"

    ${issues ? `
      ${issues}
    ` : '

    Status: OK

    '}
    `; }).join(''); document.getElementById('pdf-details-container').innerHTML = detailsHtml; const reportEl = document.getElementById('pdf-report'); reportEl.classList.remove('hidden'); const canvas = await html2canvas(reportEl, { scale: 2 }); reportEl.classList.add('hidden'); const imgData = canvas.toDataURL('image/png'); const { jsPDF } = window.jspdf; const pdf = new jsPDF({ orientation: 'p', unit: 'in', format: 'letter' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save('hreflang-Report.pdf'); } checkBtn.addEventListener('click', analyzeHreflang); document.getElementById('downloadPdfBtn').addEventListener('click', generatePdf); });
    Scroll to Top