Titre accueil « Un service Groupe KA » + icônes et balises OG/Twitter par défaut
- seo.py : titre SSR de l accueil suffixé « · Un service Groupe KA » ; render_page injecte désormais toujours og:image + twitter:card/image (og.png 1200×630 par défaut, photo du véhicule sur les fiches) en dédoublonnant les balises statiques du gabarit - index.html : favicon.svg + apple-touch-icon + og:image/twitter:image absolus (https://www.auto-ka.com/og.png) - ka-assets/ déplacé vers frontend/public/ (servi à la racine du site) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
5 changed files +24 −4
modified
autoka/seo.py
+12 −4
@@ -166,6 +166,10 @@ def render_page(*, path: str, title: str, description: str, body: str = "", | ||
| 166 | 166 | shell = re.sub(r'<meta name="description" content="[^"]*" />', |
| 167 | 167 | f'<meta name="description" content="{esc(description, quote=True)}" />', |
| 168 | 168 | shell, count=1) |
| 169 | + # og:image / twitter : retirer les balises statiques du gabarit (dist/index.html) | |
| 170 | + # pour éviter les doublons — elles sont réinjectées dynamiquement ci-dessous. | |
| 171 | + shell = re.sub(r'\s*<meta (?:property="og:image[^"]*"|name="twitter:[^"]*")' | |
| 172 | + r' content="[^"]*" />', "", shell) | |
| 169 | 173 | extra: list[str] = [f'<link rel="canonical" href="{esc(canonical, quote=True)}" />'] |
| 170 | 174 | if robots: |
| 171 | 175 | extra.append(f'<meta name="robots" content="{robots}" />') |
@@ -179,9 +183,13 @@ def render_page(*, path: str, title: str, description: str, body: str = "", | ||
| 179 | 183 | '<meta property="og:site_name" content="Auto·Ka" />', |
| 180 | 184 | '<meta property="og:locale" content="fr_CA" />', |
| 181 | 185 | ] |
| 182 | − if og_image: | |
| 183 | − extra.append(f'<meta property="og:image" content="{esc(og_image, quote=True)}" />') | |
| 184 | − extra.append('<meta name="twitter:card" content="summary_large_image" />') | |
| 186 | + img_url = og_image or (BASE_URL + "/og.png") | |
| 187 | + extra.append(f'<meta property="og:image" content="{esc(img_url, quote=True)}" />') | |
| 188 | + if not og_image: | |
| 189 | + extra.append('<meta property="og:image:width" content="1200" />') | |
| 190 | + extra.append('<meta property="og:image:height" content="630" />') | |
| 191 | + extra.append('<meta name="twitter:card" content="summary_large_image" />') | |
| 192 | + extra.append(f'<meta name="twitter:image" content="{esc(img_url, quote=True)}" />') | |
| 185 | 193 | for ld in (jsonld or []): |
| 186 | 194 | blob = json.dumps(ld, ensure_ascii=False).replace("</", "<\\/") |
| 187 | 195 | extra.append(f'<script type="application/ld+json">{blob}</script>') |
@@ -456,7 +464,7 @@ def render_404(path: str = "/introuvable") -> HTMLResponse: | ||
| 456 | 464 | _KIND_HOME = { |
| 457 | 465 | "auto": { |
| 458 | 466 | "path": "/", "who": "voitures usagées", |
| 459 | − "title": "Voitures usagées à vendre au Québec — {n} véhicules | Auto·Ka", | |
| 467 | + "title": "Voitures usagées à vendre au Québec — {n} véhicules | Auto·Ka · Un service Groupe KA", | |
| 460 | 468 | "h1": "Toutes les voitures usagées à vendre au Québec. Un seul endroit.", |
| 461 | 469 | "intro": ("Auto-Ka visite les sites des concessionnaires et marchands " |
| 462 | 470 | "d'occasion de toutes les régions du Québec, normalise chaque " |
modified
frontend/index.html
+7 −0
@@ -12,6 +12,13 @@ | ||
| 12 | 12 | href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" |
| 13 | 13 | rel="stylesheet" |
| 14 | 14 | /> |
| 15 | + <link rel="icon" type="image/svg+xml" href="/favicon.svg" /> | |
| 16 | + <link rel="apple-touch-icon" href="/apple-touch-icon.png" /> | |
| 17 | + <meta property="og:image" content="https://www.auto-ka.com/og.png" /> | |
| 18 | + <meta property="og:image:width" content="1200" /> | |
| 19 | + <meta property="og:image:height" content="630" /> | |
| 20 | + <meta name="twitter:card" content="summary_large_image" /> | |
| 21 | + <meta name="twitter:image" content="https://www.auto-ka.com/og.png" /> | |
| 15 | 22 | </head> |
| 16 | 23 | <body> |
| 17 | 24 | <div id="root"></div> |
added
frontend/public/apple-touch-icon.png
+0 −0
Binary file not shown.
added
frontend/public/favicon.svg
+5 −0
@@ -0,0 +1,5 @@ | ||
| 1 | +<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64"> | |
| 2 | +<rect width="64" height="64" rx="14" fill="#141814"/> | |
| 3 | +<rect x="4.5" y="4.5" width="55" height="55" rx="11" fill="none" stroke="#ff5a2a" stroke-opacity="0.35" stroke-width="2"/> | |
| 4 | +<text x="32" y="43" text-anchor="middle" font-family="'Space Grotesk','Arial Black',sans-serif" font-size="30" font-weight="700" letter-spacing="-1" fill="#ff5a2a" transform="rotate(-4 32 32)">Ka</text> | |
| 5 | +</svg> | |
| \ No newline at end of file | ||
added
frontend/public/og.png
+0 −0
Binary file not shown.