Calculating Food Cost Percentage

SEO Content Analyzer

Analyze your word count and keyword density to optimize your WordPress content for search engines.

Word Count
0
Char Count
0
Reading Time
0m

Top Keywords (Density)

function analyzeSeoContent() { var text = document.getElementById('seo-text-input').value; var resultsDiv = document.getElementById('seo-results'); if (!text.trim()) { alert('Please enter some text to analyze.'); return; } var words = text.toLowerCase().match(/\b(\w+)\b/g); var charCount = text.length; var wordCount = words ? words.length : 0; var readTime = Math.ceil(wordCount / 200); document.getElementById('res-word-count').innerText = wordCount; document.getElementById('res-char-count').innerText = charCount; document.getElementById('res-read-time').innerText = readTime + 'm'; var stopWords = ['the', 'and', 'a', 'to', 'of', 'in', 'is', 'it', 'with', 'for', 'on', 'that', 'this', 'was', 'as', 'are', 'be']; var freq = {}; if (words) { for (var i = 0; i 2 && stopWords.indexOf(w) === -1) { freq[w] = (freq[w] || 0) + 1; } } } var sortedKeys = Object.keys(freq).sort(function(a, b) { return freq[b] – freq[a]; }); var keywordContainer = document.getElementById('res-keywords'); keywordContainer.innerHTML = "; var limit = Math.min(sortedKeys.length, 5); for (var j = 0; j < limit; j++) { var kw = sortedKeys[j]; var count = freq[kw]; var density = ((count / wordCount) * 100).toFixed(1); var kwRow = document.createElement('div'); kwRow.style.display = 'flex'; kwRow.style.justifyContent = 'space-between'; kwRow.style.background = '#fff'; kwRow.style.padding = '8px 12px'; kwRow.style.borderRadius = '4px'; kwRow.style.fontSize = '14px'; kwRow.style.border = '1px solid #dcdcde'; kwRow.innerHTML = '' + kw + ' ' + count + ' occurrences (' + density + '%)'; keywordContainer.appendChild(kwRow); } resultsDiv.style.display = 'block'; }

Leave a Comment