SEO Audit Tool
Analyze web pages for SEO issues and generate actionable improvement recommendations.
This workflow crawls pages, analyzes on-page SEO factors, and generates prioritized fix lists.
Implementation
1import { relay } from "@relayplane/workflows";2import { fetchHTML } from "./utils";34const result = await relay5 .workflow("seo-audit")67 // Step 1: Analyze technical SEO8 .step("technical-analysis")9 .with("openai:gpt-4o")10 .prompt(`Analyze this HTML for technical SEO issues:1112{{htmlContent}}1314Check:15- Title tag (50-60 chars, keyword placement)16- Meta description (150-160 chars, compelling)17- Heading hierarchy (H1 unique, proper H2/H3 structure)18- Image alt attributes (all images, descriptive)19- Internal linking (min 3-5 relevant links)20- URL structure (readable, keyword-rich)21- Canonical tag22- Schema markup opportunities2324Return JSON with issues array and score (0-100).`)2526 // Step 2: Content quality analysis27 .step("content-analysis")28 .with("anthropic:claude-3.5-sonnet")29 .depends("technical-analysis")30 .prompt(`Analyze content quality for SEO:3132{{htmlContent}}3334Target Keyword: {{targetKeyword}}3536Evaluate:37- Keyword density (2-3% ideal)38- Keyword placement (title, H1, first 100 words)39- Content depth (min 1000 words for pillar)40- Reading level (8th grade target)41- Paragraph length (3-4 sentences)42- Use of transition words43- External authority links (2-3 minimum)4445Score each factor and provide specific fixes.`)4647 // Step 3: Competitive analysis48 .step("competitive-gap")49 .with("perplexity:sonar-pro")50 .depends("content-analysis")51 .prompt(`Analyze top-ranking competitors for this keyword:5253Keyword: {{targetKeyword}}5455Current Page Content Summary: {{contentSummary}}5657Research:58- What topics do top 3 ranking pages cover that we don't?59- Average word count of ranking pages60- Common headings/sections they include61- Unique angles they take6263Identify content gaps.`)6465 // Step 4: Generate action plan66 .step("action-plan")67 .with("anthropic:claude-3.5-sonnet")68 .depends("technical-analysis", "content-analysis", "competitive-gap")69 .prompt(`Create prioritized SEO improvement plan:7071Technical Issues: {{technical-analysis.output}}72Content Issues: {{content-analysis.output}}73Competitive Gaps: {{competitive-gap.output}}7475Prioritize fixes by:76P0 (Critical): Major ranking factors, quick wins77P1 (High): Moderate impact, reasonable effort78P2 (Low): Minor improvements, nice-to-haves7980For each item:81- Issue description82- Current state83- Recommended fix84- Estimated impact85- Implementation difficulty8687Format as actionable checklist.`)8889 .run({90 htmlContent: pageHTML,91 targetKeyword: "enterprise workflow automation",92 contentSummary: "Overview of workflow automation tools...",93 });9495console.log("SEO Score:", JSON.parse(result.steps["technical-analysis"].output).score);96console.log("Action Plan:", result.steps["action-plan"].output);Batch Site Audit
1// Audit entire site2const sitemap = await fetchSitemap("https://example.com/sitemap.xml");34const results = [];5for (const url of sitemap.urls.slice(0, 50)) {6 const html = await fetchHTML(url);78 const audit = await relay9 .workflow("seo-audit")10 .run({11 htmlContent: html,12 targetKeyword: extractKeyword(url),13 contentSummary: extractTextContent(html).slice(0, 500),14 });1516 results.push({17 url,18 score: JSON.parse(audit.steps["technical-analysis"].output).score,19 issues: audit.steps["action-plan"].output,20 });21}2223// Generate site-wide report24const sortedByScore = results.sort((a, b) => a.score - b.score);25console.log("Pages needing most work:", sortedByScore.slice(0, 10));Automated Monitoring
1# Weekly SEO health check2relayplane schedules create weekly-seo-audit \3 --workflow seo-audit \4 --cron "0 8 * * MON" \5 --input '{"url": "https://example.com/blog"}'Sample Output
Action Plan Example:**P0 - Critical (Fix This Week)** - Missing H1 tag - Add "Enterprise Workflow Automation Guide" - Title too short (38 chars) - Expand to include target keyword - No meta description - Write compelling 155-char description **P1 - High Priority** - Content thin (620 words) - Expand to 1,500+ words - Only 1 internal link - Add 4-6 contextual links - 3 images missing alt text - Add descriptive alt attributes **P2 - Nice to Have** - Add FAQ schema for featured snippets - Improve reading level (current: 12th grade, target: 8th)