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:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user