Files
boc/landvex-fix/fix_canonicals.py
T
Bernt 6989a98d75 feat: Passwordless cross-device authentication
- Arkitektur: docs/auth/passwordless-architecture.md
- Backend: iom/quixzoom-auth-service/ (FastAPI + Redis)
- Webb: quixzoom-market-pages/se/login/ (QR-kod + polling)
- App: iom/quixzoom-app/src/features/auth/ (push + deep links)

Flöde: QR-kod → app-godkännande → webb-inloggad
2026-07-07 07:11:50 +00:00

58 lines
1.7 KiB
Python

#!/usr/bin/env python3
"""
Fix canonical URLs on redirect pages.
"""
import os
# Files that need canonical fixes (path -> correct canonical)
CANONICAL_FIXES = {
"about/index.html": "https://landvex.com/about/",
"blog/index.html": "https://landvex.com/blog/",
"comparison/index.html": "https://landvex.com/comparison/",
"enterprise/index.html": "https://landvex.com/enterprise/",
"pilot/index.html": "https://landvex.com/pilot/",
}
def fix_canonical(filepath, correct_canonical):
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
# Find and replace canonical href
original = content
content = content.replace(
f'<link rel="canonical" href="',
f'<link rel="canonical" href="{correct_canonical}">\n <!-- old: '
)
# Actually, let's do it properly
content = original
# Replace the canonical line
import re
content = re.sub(
r'<link rel="canonical" href="[^"]+">',
f'<link rel="canonical" href="{correct_canonical}">',
content
)
if content != original:
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
return True
return False
def main():
base_dir = "/home/bernt/.openclaw/workspace/landvex-all"
for rel_path, canonical in CANONICAL_FIXES.items():
filepath = os.path.join(base_dir, rel_path)
if os.path.exists(filepath):
if fix_canonical(filepath, canonical):
print(f"Fixed canonical: {rel_path} -> {canonical}")
else:
print(f"No change needed: {rel_path}")
else:
print(f"File not found: {rel_path}")
if __name__ == "__main__":
main()