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:
@@ -22,6 +22,7 @@ from dash import (
|
|||||||
from figures import make_column_picker
|
from figures import make_column_picker
|
||||||
from src.figures import DataTable
|
from src.figures import DataTable
|
||||||
from src.utils import (
|
from src.utils import (
|
||||||
|
add_canonical_link,
|
||||||
columns,
|
columns,
|
||||||
df,
|
df,
|
||||||
filter_table_data,
|
filter_table_data,
|
||||||
@@ -525,3 +526,8 @@ def sync_sort_to_local_storage(sort_by):
|
|||||||
)
|
)
|
||||||
def reset_view(n_clicks):
|
def reset_view(n_clicks):
|
||||||
return "", []
|
return "", []
|
||||||
|
|
||||||
|
|
||||||
|
@callback(Input("tableau_url", "pathname"))
|
||||||
|
def cb_add_canonical_link(pathname):
|
||||||
|
add_canonical_link(pathname)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import uuid
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from time import localtime, sleep
|
from time import localtime, sleep
|
||||||
|
|
||||||
|
import dash
|
||||||
import polars as pl
|
import polars as pl
|
||||||
import polars.selectors as cs
|
import polars.selectors as cs
|
||||||
from httpx import get, post
|
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
|
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()
|
df: pl.DataFrame = get_decp_data()
|
||||||
schema = df.collect_schema()
|
schema = df.collect_schema()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user