Fix Orphaned affiliateProducts Frontmatter
5 min readBy FieldGrade Team
Fix Orphaned affiliateProducts Frontmatter
CONCLUSIONS:
- Articles with
affiliateProducts: []but containing/go/links have inconsistent frontmatter. - These articles require updating
affiliateProductsto include the actual product IDs from the links for accurate affiliate tracking.
SUPPORTING DETAIL:
- Audit Scope: Scan all fieldgrade articles for
affiliateProducts: []and search body content for/go/links. - Mapping Logic: Extract product IDs from
/go/URLs (e.g.,/go/12345→12345) and populateaffiliateProductsarray. - Validation: Ensure updated
affiliateProductsmatches all inline links in the article body. - Edge Cases: If an article has no
/go/links, retainaffiliateProducts: []to avoid false positives.