Ajout d'un lien canonique vers chaque page dans le head #70

Dynamique, donc pas sûr que les moteurs de recherche le voit.
This commit is contained in:
Colin Maudry
2026-02-02 18:28:05 +01:00
parent ef11184286
commit deba0a244e
2 changed files with 15 additions and 0 deletions
+9
View File
@@ -5,6 +5,7 @@ import uuid
from collections import OrderedDict
from time import localtime, sleep
import dash
import polars as pl
import polars.selectors as cs
from httpx import get, post
@@ -721,6 +722,14 @@ def make_org_jsonld(org_id, org_type, org_name=None, type_org_id="SIRET") -> dic
return jsonld
def add_canonical_link(pathname):
@dash.hooks.index()
def update_index(html_string):
url = f"https://{domain_name}{pathname}"
canonical_tag = f'<link rel="canonical" href="{url}" />'
return html_string.replace("</head>", f"{canonical_tag}\n </head>")
df: pl.DataFrame = get_decp_data()
schema = df.collect_schema()