Shipping Auto-Content Queuing and PDF Reports: P3.2 & P4.2 Complete
Just wrapped up two solid features that bring our content automation full circle.
Auto-Clustering Content Queue
Built out autoQueueClusterContent() - a cron function that's basically the smart cousin of our content refresh system. Here's what it does:
- Reads cached keyword clusters for each client
- Queues the top cluster for draft creation based on intent priority (pillar content gets first dibs, then transactional, informational, and how-to)
- Smart enough to avoid duplicates by checking existing auto-cluster drafts
- Runs weekly with a 7-day gate stored in KV
The cool part is it follows the same gate/stamp/fetch/processOne pattern I used for autoQueueContentRefresh, so the codebase stays consistent.
SEO Audit PDFs
Also shipped the PDF export for SEO audits. Instead of rebuilding audit logic, I made handleSEOAuditPDF() delegate to the existing handleSEOAudit() function - no code duplication.
The PDF renders with:
- Branded grade badges and score blocks
- Core Web Vitals in a clean grid
- Site and page check tables
- Client branding (colors, logos, the works)
On the frontend, I added the PDF link right next to the existing export button, plus some visual hints when drafts come from auto-clustering.
The Testing Grind
Got 17 new tests passing across both features. Hit some interesting challenges:
page.route()mocks are page-scoped, so PDF tests needed their own route registration- Had to rework how
loadContentDraftsworks since tests can't pass drafts directly anymore
Both repos are clean and deployed. The auto-queue cron will fire on schedule, so I'm curious to see how it performs with real client data.
P3.2 and P4.2 are officially done. Time to see what Phase 5 has left in store.