MAJ 18022024
This commit is contained in:
parent
26ecadd238
commit
94c215a253
@ -17,10 +17,12 @@
|
||||
<meta name="twitter:title" content="Titre par défaut - Bureau d’études">
|
||||
<meta name="twitter:description" content="Bienvenue sur notre bureau d’études en Maîtrise d’œuvre.">
|
||||
<meta name="twitter:image" content="https://preprod.octopusdesign.fr/api-octopus/server/wp-content/uploads/2025/01/Construction-logements-au-Mans-01.avif">
|
||||
<link rel="preload" href="/src/assets/vendor-BFTbvl5C.js" as="script">
|
||||
<!-- <link rel="preload" href="/src/assets/vendor-BFTbvl5C.js" as="script"> -->
|
||||
<link rel="preload" href="/assets/index-CfManBR6.css" as="style">
|
||||
<link rel="stylesheet" href="/assets/index-CfManBR6.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.jsx"></script>
|
||||
<script type="module" src="/src/main.jsx" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
608
frontend/package-lock.json
generated
608
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -153,7 +153,7 @@ const Home = () => {
|
||||
Un service exceptionnel, une équipe formidable
|
||||
</Typography>
|
||||
<Typography variant="body2" sx={{ mt: 2, textAlign: "right", fontWeight: "bold" }}>
|
||||
- Client 1
|
||||
- zertides
|
||||
</Typography>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@ -1,64 +1,93 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { Helmet } from "react-helmet-async"; // ✅ SEO
|
||||
import ServicePageTemplate from "../ServicePageTemplate";
|
||||
import { getPageById } from "../../wordpress";
|
||||
|
||||
|
||||
/**
|
||||
* ✅ Fonction pour supprimer les balises HTML des champs WYSIWYG
|
||||
*/
|
||||
const stripHtml = (html) => {
|
||||
const doc = new DOMParser().parseFromString(html || "", "text/html");
|
||||
return doc.body.textContent || "";
|
||||
};
|
||||
|
||||
const ServiceQuatre = () => {
|
||||
const [acfData, setAcfData] = useState(null);
|
||||
const [seoData, setSeoData] = useState(null); // ✅ Stocke les données SEO de RankMath
|
||||
const [loading, setLoading] = useState(true);
|
||||
const pageId = 590; // 🔥 Remplace par l'ID réel de la page WordPress
|
||||
const pageId = 590; // 🔥 ID réel de la page WordPress
|
||||
|
||||
useEffect(() => {
|
||||
const fetchACFData = async () => {
|
||||
const fetchPageData = async () => {
|
||||
try {
|
||||
const pageData = await getPageById(pageId);
|
||||
setAcfData(pageData.acf);
|
||||
|
||||
// ✅ Vérification des données ACF
|
||||
if (pageData.acf) {
|
||||
setAcfData(pageData.acf);
|
||||
} else {
|
||||
console.warn("⚠ Aucune donnée ACF trouvée !");
|
||||
}
|
||||
|
||||
// ✅ Récupération des données SEO depuis RankMath
|
||||
if (pageData.rankMath?.assessor?.serpData) {
|
||||
const serpData = pageData.rankMath.assessor.serpData;
|
||||
console.log("📢 Données SEO récupérées :", serpData);
|
||||
|
||||
setSeoData({
|
||||
metaTitle: serpData.title || pageData.title?.rendered || "Titre par défaut",
|
||||
metaDescription: serpData.description || "Description par défaut",
|
||||
keywords: serpData.focusKeywords || "bureau d'études, construction, rénovation",
|
||||
ogImage: serpData.ogImage || "https://picsum.photos/id/1018/1920/1080.webp",
|
||||
});
|
||||
} else {
|
||||
console.warn("⚠ Aucune donnée SEO trouvée dans RankMath !");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("❌ Erreur récupération des champs ACF :", error);
|
||||
console.error("❌ Erreur récupération des champs ACF et SEO :", error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
fetchACFData();
|
||||
fetchPageData();
|
||||
}, []);
|
||||
|
||||
// ✅ Affichage du chargement en attendant les données ACF
|
||||
if (loading) {
|
||||
return <p>Chargement...</p>;
|
||||
}
|
||||
|
||||
const serviceDetails = {
|
||||
// Hero
|
||||
title: acfData?.titre_principal || "Titre héros !", // ✅ Modifiable individuellement
|
||||
subtitle: <span dangerouslySetInnerHTML={{ __html: acfData?.description_principal || "Description, héros" }} />,
|
||||
title: acfData?.titre_principal || "Titre héros !",
|
||||
subtitle: stripHtml(acfData?.description_principal) || "Description, héros",
|
||||
|
||||
image: "https://picsum.photos/id/1021/1920/1080.webp",
|
||||
image: acfData?.hero_image || "https://preprod.octopusdesign.fr/api-octopus/server/wp-content/uploads/2025/02/service-securite-incendie.webp",
|
||||
ctaText: "En savoir plus",
|
||||
ctaLink: "/contact",
|
||||
|
||||
// section 1
|
||||
interestTitle: acfData?.second_titre || "Titre interet", // ✅ Modifiable individuellement
|
||||
description: <span dangerouslySetInnerHTML={{ __html: acfData?.second_description || "Description interet" }} />,
|
||||
// section 2
|
||||
desirTitle: "Titre", // ✅ Modifiable individuellement
|
||||
interestTitle: acfData?.second_titre || "Titre interet",
|
||||
description: stripHtml(acfData?.second_description) || "Description interet",
|
||||
|
||||
desirTitle: "Titre",
|
||||
|
||||
features: [
|
||||
{
|
||||
title: acfData?.titre_carte_one || "Titre !",
|
||||
description: acfData?.description_carte_one || "Description.",
|
||||
modalText: acfData?.description_carte_one || "Description Modal.",
|
||||
description: stripHtml(acfData?.description_carte_one).substring(0, 100) + "...",
|
||||
modalText: stripHtml(acfData?.description_carte_one) || "Description Modal.",
|
||||
modalImage: "https://picsum.photos/id/300/800/400.webp",
|
||||
},
|
||||
{
|
||||
title: acfData?.titre_carte_two || "Titre !",
|
||||
description: acfData?.description_carte_two || "Description.",
|
||||
modalText: acfData?.description_carte_two || "Description Modal.",
|
||||
description: stripHtml(acfData?.description_carte_two).substring(0, 100) + "...",
|
||||
modalText: stripHtml(acfData?.description_carte_two) || "Description Modal.",
|
||||
modalImage: "https://picsum.photos/id/301/800/400.webp",
|
||||
},
|
||||
{
|
||||
title: acfData?.titre_carte_tree || "Titre !",
|
||||
description: acfData?.description_carte_tree || "Description.",
|
||||
modalText: acfData?.description_carte_tree || "Description Modal.",
|
||||
description: stripHtml(acfData?.description_carte_tree).substring(0, 100) + "...",
|
||||
modalText: stripHtml(acfData?.description_carte_tree) || "Description Modal.",
|
||||
modalImage: "https://picsum.photos/id/302/800/400.webp",
|
||||
},
|
||||
],
|
||||
@ -66,18 +95,31 @@ const ServiceQuatre = () => {
|
||||
carouselItems: [
|
||||
{
|
||||
title: "Portfolio Modern",
|
||||
description: "Montrez vos compétences avec un portfolio unique.",
|
||||
image: "https://picsum.photos/id/305/800/400.webp",
|
||||
description: "Description de l'image",
|
||||
image: "https://preprod.octopusdesign.fr/api-octopus/server/wp-content/uploads/2025/02/securite-incendie.webp",
|
||||
width: 800,
|
||||
height: 400,
|
||||
},
|
||||
{
|
||||
title: "Blog SEO",
|
||||
description: "Optimisez vos articles pour le référencement.",
|
||||
image: "https://picsum.photos/id/306/800/400.webp",
|
||||
title: "service securité S.S.I",
|
||||
description: "Description de l'image",
|
||||
image: "https://preprod.octopusdesign.fr/api-octopus/server/wp-content/uploads/2025/02/service-securite-ssi.webp",
|
||||
width: 800,
|
||||
height: 400,
|
||||
},
|
||||
],
|
||||
|
||||
// ✅ Ajout du SEO dynamique récupéré via RankMath
|
||||
seo: {
|
||||
metaTitle: seoData?.metaTitle || "Pourquoi faire appel à un bureau d’études ?",
|
||||
metaDescription: seoData?.metaDescription || "Description SEO par défaut",
|
||||
keywords: seoData?.keywords || "bureau d'études, construction, rénovation",
|
||||
ogImage: seoData?.ogImage || "https://preprod.octopusdesign.fr/api-octopus/server/wp-content/uploads/2025/02/service-securite-incendie.webp",
|
||||
},
|
||||
};
|
||||
|
||||
return <ServicePageTemplate {...serviceDetails} />;
|
||||
return <ServicePageTemplate {...serviceDetails} />
|
||||
|
||||
};
|
||||
|
||||
export default ServiceQuatre;
|
||||
export default ServiceQuatre;
|
||||
@ -226,7 +226,7 @@ export async function getPageById(pageId) {
|
||||
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`https://preprod.octopusdesign.fr/api-octopus/server/wp-json/wp/v2/pages/${pageId}?_fields=id,title,acf`
|
||||
`https://preprod.octopusdesign.fr/api-octopus/server/wp-json/wp/v2/pages/${pageId}?_fields=id,title,acf,_rank_math_seo_meta`
|
||||
);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
|
||||
@ -4,53 +4,53 @@ import viteCompression from 'vite-plugin-compression';
|
||||
import { visualizer } from 'rollup-plugin-visualizer';
|
||||
import path from 'path';
|
||||
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
// Plugin React
|
||||
// ✅ Plugin React
|
||||
react(),
|
||||
// Compression Brotli
|
||||
|
||||
// ✅ Compression Brotli & Gzip fusionnées
|
||||
viteCompression({
|
||||
algorithm: 'brotliCompress',
|
||||
algorithm: 'brotliCompress', // Utilisation de Brotli en priorité
|
||||
ext: '.br',
|
||||
threshold: 10240, // Fichiers supérieurs à 10 Ko seront compressés
|
||||
threshold: 10240, // Compression à partir de 10 Ko
|
||||
}),
|
||||
// Compression Gzip
|
||||
viteCompression({
|
||||
algorithm: 'gzip',
|
||||
algorithm: 'gzip', // Compression Gzip en fallback
|
||||
ext: '.gz',
|
||||
threshold: 10240,
|
||||
}),
|
||||
// Visualiseur de bundle
|
||||
|
||||
// ✅ Visualisation des bundles (ouvre `stats.html` après le build)
|
||||
visualizer({
|
||||
open: true, // Ouvre automatiquement le fichier généré après le build
|
||||
open: false, // Mets `true` si tu veux ouvrir le fichier automatiquement
|
||||
filename: 'stats.html',
|
||||
template: 'treemap',
|
||||
}),
|
||||
],
|
||||
|
||||
|
||||
resolve: {
|
||||
alias: {
|
||||
// Définit les alias pour des chemins simplifiés
|
||||
'@pages': path.resolve(__dirname, './src/pages'),
|
||||
'@components': path.resolve(__dirname, './src/components'),
|
||||
'@assets': path.resolve(__dirname, './src/assets'),
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
build: {
|
||||
chunkSizeWarningLimit: 1000,
|
||||
target: 'esnext', // Cible des navigateurs modernes
|
||||
minify: 'esbuild', // Minification avec esbuild pour une meilleure performance
|
||||
sourcemap: false, // Désactive les sourcemaps en production (activez pour dev si nécessaire)
|
||||
target: 'esnext', // ✅ Meilleure compatibilité avec les navigateurs modernes
|
||||
minify: 'esbuild', // ✅ Utilisation d'Esbuild pour un build rapide
|
||||
sourcemap: true, // ✅ Active les source maps en production (utile pour le debug)
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks(id) {
|
||||
// Création de chunks manuels pour optimiser les performances
|
||||
if (id.includes('node_modules')) {
|
||||
if (id.includes('@mui')) {
|
||||
return 'vendor_mui'; // Chunk spécifique à MUI
|
||||
return 'vendor_mui'; // ✅ Sépare MUI du reste des dépendances
|
||||
}
|
||||
return 'vendor'; // Autres dépendances
|
||||
return 'vendor'; // ✅ Sépare les dépendances globales
|
||||
}
|
||||
},
|
||||
},
|
||||
@ -58,18 +58,16 @@ export default defineConfig({
|
||||
},
|
||||
|
||||
server: {
|
||||
port: 3000, // Définit le port du serveur de développement
|
||||
open: true, // Ouvre automatiquement le navigateur au démarrage
|
||||
cors: true, // Autorise toutes les requêtes CORS
|
||||
port: 3000, // ✅ Serveur sur le port 3000
|
||||
open: true, // ✅ Ouvre le navigateur au démarrage
|
||||
cors: true, // ✅ Active les requêtes CORS
|
||||
},
|
||||
|
||||
optimizeDeps: {
|
||||
include: [
|
||||
'swiper/react', // Inclut swiper/react dans les dépendances optimisées
|
||||
'swiper/modules', // Inclut swiper/modules dans les dépendances optimisées
|
||||
],
|
||||
exclude: [
|
||||
'cssnano', // Exclut les dépendances problématiques comme cssnano
|
||||
'swiper/react',
|
||||
'swiper/modules',
|
||||
],
|
||||
|
||||
},
|
||||
});
|
||||
@ -304,4 +304,21 @@ function update_acf_mission($post, $request) {
|
||||
}
|
||||
}
|
||||
|
||||
add_action('rest_after_insert_page', 'update_acf_mission', 10, 2);
|
||||
add_action('rest_after_insert_page', 'update_acf_mission', 10, 2);
|
||||
|
||||
function add_rankmath_to_rest_api($response, $post, $request) {
|
||||
$seo_meta = get_post_meta($post->ID, 'rank_math_description', true);
|
||||
$seo_title = get_post_meta($post->ID, 'rank_math_title', true);
|
||||
|
||||
if (!empty($seo_meta)) {
|
||||
$response->data['seo_description'] = $seo_meta;
|
||||
}
|
||||
|
||||
if (!empty($seo_title)) {
|
||||
$response->data['seo_title'] = $seo_title;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
add_filter('rest_prepare_page', 'add_rankmath_to_rest_api', 10, 3);
|
||||
Loading…
Reference in New Issue
Block a user