← Back to Analysis

SEO Agent

seo.check.js

What This Agent Does

The SEO Agent audits search engine optimization factors including meta tags, heading structure, structured data, Open Graph tags, and content quality indicators.

Category Information

Property Value
Category Name SEO & Metadata
Category Icon
Source File src/checks/seo.check.js

Checks Performed

Title Tag

Validates presence and length (50-60 characters optimal).

Meta Description

Checks for description meta tag (150-160 characters optimal).

Heading Structure

Validates H1 presence and proper heading hierarchy.

Canonical URL

Checks for canonical link to prevent duplicate content.

Open Graph Tags

Validates og:title, og:description, og:image for social sharing.

Twitter Cards

Checks for twitter:card and related meta tags.

Structured Data

Detects JSON-LD or microdata for rich search results.

Robots Meta

Checks robots meta tag and X-Robots-Tag header.

Data Sources

Libraries Used

  • axios — HTTP client for fetching the page
  • cheerio — jQuery-like HTML parsing

HTML Parsing

const cheerio = require('cheerio');
const response = await axios.get(url);
const $ = cheerio.load(response.data);

// Extract meta tags
const title = $('title').text();
const description = $('meta[name="description"]').attr('content');
const canonical = $('link[rel="canonical"]').attr('href');

// Open Graph
const ogTitle = $('meta[property="og:title"]').attr('content');
const ogImage = $('meta[property="og:image"]').attr('content');

// Headings
const h1Count = $('h1').length;
const headings = $('h1, h2, h3, h4, h5, h6').toArray();

SEO Best Practices

Element Recommendation
Title 50-60 characters, unique, contains primary keyword
Meta Description 150-160 characters, compelling, contains keywords
H1 Exactly one per page, unique, descriptive
Canonical Points to the preferred URL version

Return Value

{
  category: 'SEO & Metadata',
  icon: 'chart',
  score: 0-100,
  checks: [
    {
      name: 'Title Tag',
      status: 'pass',
      description: 'Title present: "Your Page Title" (52 chars)',
      severity: 'high'
    },
    {
      name: 'Meta Description',
      status: 'pass' | 'fail' | 'warn',
      description: 'Description present and optimal length',
      severity: 'high'
    },
    // ... more checks
  ]
}