Optional resource: View the recommended programme. This is an affiliate link.
'''
if hero_anchor in html and "View the recommended programme" not in html:
html = html.replace(hero_anchor, hero_insert)
# Add a second CTA near the closing section, without making claims about the linked offer.
closing_anchor = 'Start the 7-day reflection practice →'
closing_insert = closing_anchor + '''
Looking for an additional resource? View the recommended programme.
''' if closing_anchor in html and html.count(affiliate_url) < 2: html = html.replace(closing_anchor, closing_insert) # Add a plain-language affiliate disclosure to the footer disclaimer. disclosure = ' Affiliate disclosure: Some links on this page are affiliate links. If you make a purchase through the link, the site owner may earn a commission at no additional cost to you. The link does not change the educational nature of this page.' footer_anchor = 'Educational disclaimer:' if footer_anchor in html and "Affiliate disclosure:" not in html: html = html.replace(footer_anchor, disclosure + ' ' + footer_anchor) path.write_text(html, encoding="utf-8") print(f"Updated: {path} ({path.stat().st_size:,} bytes)") print(f"Affiliate URL occurrences: {html.count(affiliate_url)}")