26 lines
1.3 KiB
PowerShell
26 lines
1.3 KiB
PowerShell
$count = 0
|
|
$dir = "C:/Users/eugen/.cursor/projects/Odoo Expertos/odoo-expertos/en"
|
|
Get-ChildItem -Path $dir -Recurse -Filter "*.html" | ForEach-Object {
|
|
$content = Get-Content $_.FullName -Raw -Encoding UTF8
|
|
$original = $content
|
|
|
|
# Fix canonicals that already have /en/ but missing www
|
|
$content = $content -replace 'href="https://odoo-expertos\.com/en/', 'href="https://www.odoo-expertos.com/en/'
|
|
|
|
# Fix canonicals missing /en/ and www (lowercase odoo)
|
|
$content = $content -replace 'href="https://odoo-expertos\.com/([^e"])', 'href="https://www.odoo-expertos.com/en/$1'
|
|
$content = $content -replace 'href="https://odoo-expertos\.com/e([^n"])', 'href="https://www.odoo-expertos.com/en/e$1'
|
|
|
|
# Fix canonicals with mixed case Odoo-expertos (common pattern seen)
|
|
$content = $content -replace 'href="https://Odoo-expertos\.com/en/', 'href="https://www.odoo-expertos.com/en/'
|
|
$content = $content -replace 'href="https://Odoo-expertos\.com/([^e"])', 'href="https://www.odoo-expertos.com/en/$1'
|
|
$content = $content -replace 'href="https://Odoo-expertos\.com/e([^n"])', 'href="https://www.odoo-expertos.com/en/e$1'
|
|
|
|
if ($content -ne $original) {
|
|
Set-Content -Path $_.FullName -Value $content -NoNewline -Encoding UTF8
|
|
Write-Host "Fixed: $($_.Name)"
|
|
$count++
|
|
}
|
|
}
|
|
Write-Host "`nTotal files fixed: $count"
|