import os

html_files_except_index = [
    'construction-company-in-krishnagiri.html',
    'home-builder-in-krishnagiri.html',
    'architecture-firm-in-krishnagiri.html',
    'interior-designers-in-krishnagiri.html',
    'about-us.html',
    'faq.html',
    'contact-us.html'
]

dir_path = r'd:\xampp\htdocs\mkconstruction'

for filename in html_files_except_index:
    filepath = os.path.join(dir_path, filename)
    with open(filepath, 'r', encoding='utf-8') as f:
        content = f.read()

    content = content.replace('href="#services"', 'href="index.html#services"')
    content = content.replace('href="#portfolio"', 'href="index.html#portfolio"')
    
    with open(filepath, 'w', encoding='utf-8') as f:
        f.write(content)

print("Fixed internal anchors on secondary pages.")
