$files = Get-ChildItem -Path "site\*.html", "site\tools\*.html", "site\blog\articles\*.html"

foreach ($file in $files) {
    $content = Get-Content $file.FullName -Raw
    
    # Remove the preconnect and stylesheet links for Google Fonts
    $newContent = $content -replace '(?s)<link rel="preconnect" href="https://fonts\.googleapis\.com">[\r\n\s]*<link rel="preconnect" href="https://fonts\.gstatic\.com"[^>]*>[\r\n\s]*<link href="https://fonts\.googleapis\.com/css2[^>]*>[\r\n]*', ''
    
    if ($content -ne $newContent) {
        Set-Content -Path $file.FullName -Value $newContent -Encoding UTF8
    }
}
Write-Host "Google Fonts links stripped from all HTML files."
