import io p = "/Users/drjones/pest-nocturne/index.html" s = open(p).read() # ---- SEO head block (title + meta + OG + JSON-LD) ---- seo_head = '''Evergreen Applicator — Washington Pesticide Applicator Exam Prep & Practice Tests ''' # 1. Replace the bare title with the full SEO head s = s.replace("Pest Nocturne", seo_head, 1) # 2. Brand comment header s = s.replace( " PEST NOCTURNE — a midnight specimen cabinet for WSU EM019", " EVERGREEN APPLICATOR — Washington pesticide applicator exam prep", 1, ) # 3. Header brand mark s = s.replace( " Pest Nocturne\n ", " Evergreen Applicator\n ", 1, ) # 4. WA Cert view H1 (line ~2019) — make it keyword-rich s = s.replace( '

A hyper study suite for thePest
Nocturne

', '

Washington pesticide applicatorEvergreen
Applicator

', 1, ) # 5. Premium gate comment s = s.replace( "PEST NOCTURNE — PREMIUM GATE (injected)", "EVERGREEN APPLICATOR — PREMIUM GATE (injected)", 1, ) # 6. BMAC footer s = s.replace( "Pest Nocturne — a study suite for WSU EM019", "Evergreen Applicator — Washington pesticide applicator exam prep", 1, ) open(p, "w").write(s) # report any remaining "Nocturne" (case-insensitive) import re left = re.findall(r'(?i)nocturne', s) print("remaining 'nocturne' refs:", len(left)) print("renamed + SEO head added; size", len(s))