Correction des balises meta #39

This commit is contained in:
Colin Maudry
2025-09-28 22:08:03 +02:00
parent 70c5b91e6d
commit ce9d23100d
7 changed files with 53 additions and 52 deletions
+1 -38
View File
@@ -1,5 +1,4 @@
import logging
import os
import dash_bootstrap_components as dbc
from dash import Dash, dcc, html, page_container, page_registry
@@ -8,47 +7,11 @@ from flask import send_from_directory
load_dotenv()
domain_name = (
"test.decp.info" if os.getenv("DEVELOPMENT").lower() == "true" else "decp.info"
)
image_url = f"https://{domain_name}/assets/decp.info.png"
title = "decp.info - exploration des marchés publics français"
description = (
"Explorez et analysez les données des marchés publics français avec cet outil libre et gratuit. "
"Pour une commande publique accessible à toutes et tous."
)
app = Dash(
external_stylesheets=[dbc.themes.SIMPLEX],
title="decp.info",
use_pages=True,
compress=True,
meta_tags=[
{
"property": "og:image",
"content": image_url,
},
{
"name": "twitter:image",
"content": image_url,
},
{
"property": "og:title",
"content": title,
},
{
"name": "twitter:title",
"content": title,
},
{
"property": "og:description",
"content": description,
},
{
"name": "twitter:description",
"content": description,
},
],
)
# COSMO (belle font, blue),
# UNITED (rouge, ubuntu font),
@@ -71,7 +34,7 @@ logging.basicConfig(
app.index_string = """
<!DOCTYPE html>
<html>
<html lang="fr">
<head>
{%metas%}
<title>{%title%}</title>
+10 -3
View File
@@ -3,18 +3,25 @@ import os
from dash import dcc, html, register_page
from src.figures import get_sources_tables
from src.utils import meta_content
title = "À propos"
name = "À propos"
register_page(
__name__, path="/a-propos", title=f"decp.info - {title}", name=title, order=5
__name__,
path="/a-propos",
title=meta_content["title"],
name=name,
description=meta_content["description"],
image_url=meta_content["image_url"],
order=5,
)
layout = [
html.Div(
className="container",
children=[
html.H2(title),
html.H2(name),
dcc.Markdown(
"""Outil d'exploration libre et gratuit des données de marchés publics, développé par Colin Maudry.
+4 -1
View File
@@ -10,13 +10,16 @@ from src.utils import (
get_annuaire_data,
get_departement_region,
lf,
meta_content,
)
register_page(
__name__,
path_template="/acheteurs/<acheteur_id>",
title="decp.info - acheteur",
title=meta_content["title"],
name="Acheteur",
description=meta_content["description"],
image_url=meta_content["image_url"],
order=5,
)
+11 -3
View File
@@ -10,6 +10,7 @@ from src.utils import (
filter_table_data,
format_number,
lf,
meta_content,
sort_table_data,
)
@@ -18,9 +19,16 @@ update_date = datetime.fromtimestamp(update_date).strftime("%d/%m/%Y")
schema = lf.collect_schema()
title = "Tableau"
register_page(__name__, path="/", title="decp.info", name=title, order=1)
name = "Tableau"
register_page(
__name__,
path="/",
title=meta_content["title"],
name=name,
description=meta_content["description"],
image_url=meta_content["image_url"],
order=1,
)
datatable = html.Div(
className="marches_table",
+10 -4
View File
@@ -1,12 +1,18 @@
from dash import dcc, html, register_page
from src.figures import get_barchart_sources, get_map_count_marches
from src.utils import lf
from src.utils import lf, meta_content
title = "Statistiques"
name = "Statistiques"
register_page(
__name__, path="/statistiques", title=f"decp.info - {title}", name=title, order=3
__name__,
path="/statistiques",
title=meta_content["title"],
name=name,
description=meta_content["description"],
image_url=meta_content["image_url"],
order=3,
)
@@ -14,7 +20,7 @@ layout = [
html.Div(
className="container",
children=[
html.H2(title),
html.H2(name),
dcc.Loading(
overlay_style={"visibility": "visible", "filter": "blur(2px)"},
id="loading-statistques",
+6 -3
View File
@@ -10,13 +10,16 @@ from src.utils import (
get_annuaire_data,
get_departement_region,
lf,
meta_content,
)
register_page(
__name__,
path_template="/titulaires/<titulaire_id>",
title="decp.info - titulaire",
name="Fournisseur",
title=meta_content["title"],
name="Titulaire",
description=meta_content["description"],
image_url=meta_content["image_url"],
order=5,
)
@@ -245,7 +248,7 @@ def get_last_marches_table(data) -> html.Div:
"whiteSpace": "normal",
},
{
"if": {"column_id": "acheteur_nom"},
"if": {"column_id": " acheteur_nom"},
"minWidth": "200px",
"textAlign": "left",
"overflow": "hidden",
+11
View File
@@ -227,3 +227,14 @@ def sort_table_data(lff: pl.LazyFrame, sort_by: list) -> pl.LazyFrame:
lf = get_decp_data()
departements = get_departements()
domain_name = (
"test.decp.info" if os.getenv("DEVELOPMENT").lower() == "true" else "decp.info"
)
meta_content = {
"image_url": f"https://{domain_name}/assets/decp.info.png",
"title": "decp.info - exploration des marchés publics français",
"description": (
"Explorez et analysez les données des marchés publics français avec cet outil libre et gratuit. "
"Pour une commande publique accessible à toutes et tous."
),
}