:root {
–primary-color: #3b82f6;
–secondary-color: #1e40af;
–accent-color: #f59e0b;
–success-color: #10b981;
–warning-color: #f97316;
–error-color: #ef4444;
–text-dark: #1f2937;
–text-light: #6b7280;
–text-muted: #9ca3af;
–bg-primary: #ffffff;
–bg-secondary: #f8fafc;
–bg-tertiary: #f1f5f9;
–gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
–gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
–gradient-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
–shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
–shadow-md: 0 4px 6px rgba(0,0,0,0.1);
–shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
–shadow-xl: 0 20px 25px rgba(0,0,0,0.15);
–border-radius: 12px;
–border-radius-lg: 16px;
–transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}* {
box-sizing: border-box;
margin: 0;
padding: 0;
}body {
font-family: ‘Inter’, -apple-system, BlinkMacSystemFont, ‘Segoe UI’, Roboto, sans-serif;
line-height: 1.6;
color: var(–text-dark);
background: var(–bg-secondary);
}.container {
max-width: 1400px;
margin: 0 auto;
padding: 0 20px;
}/* Hero Section */
.hero-section {
background: var(–gradient-primary);
color: white;
padding: 4rem 0 6rem;
position: relative;
overflow: hidden;
}.hero-section::before {
content: »;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: url(‘data:image/svg+xml,
‘);
opacity: 0.6;
}.hero-content {
position: relative;
z-index: 2;
text-align: center;
max-width: 900px;
margin: 0 auto;
}.hero-title {
font-size: clamp(2.5rem, 5vw, 4rem);
font-weight: 800;
margin-bottom: 1.5rem;
line-height: 1.1;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}.hero-subtitle {
font-size: clamp(1.1rem, 2vw, 1.3rem);
margin-bottom: 2rem;
opacity: 0.95;
font-weight: 500;
max-width: 800px;
margin-left: auto;
margin-right: auto;
text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}.hero-badges {
display: flex;
justify-content: center;
gap: 1rem;
flex-wrap: wrap;
margin-top: 2.5rem;
}.hero-badge {
background: rgba(255,255,255,0.15);
padding: 0.8rem 1.5rem;
border-radius: 50px;
backdrop-filter: blur(10px);
border: 1px solid rgba(255,255,255,0.2);
font-size: 0.9rem;
font-weight: 600;
display: flex;
align-items: center;
gap: 0.5rem;
transition: var(–transition);
}.hero-badge:hover {
background: rgba(255,255,255,0.25);
transform: translateY(-2px);
}/* Search Section */
.search-section {
background: var(–bg-primary);
padding: 2rem 0;
margin-top: -3rem;
position: relative;
z-index: 3;
}.search-container {
background: white;
border-radius: var(–border-radius-lg);
box-shadow: var(–shadow-xl);
padding: 2rem;
max-width: 600px;
margin: 0 auto;
}.search-title {
text-align: center;
font-size: 1.5rem;
font-weight: 700;
margin-bottom: 1.5rem;
color: var(–text-dark);
}.search-box {
position: relative;
margin-bottom: 1rem;
}.search-input {
width: 100%;
padding: 1rem 1rem 1rem 3rem;
border: 2px solid #e5e7eb;
border-radius: var(–border-radius);
font-size: 1rem;
transition: var(–transition);
background: #f9fafb;
}.search-input:focus {
outline: none;
border-color: var(–primary-color);
background: white;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}.search-icon {
position: absolute;
left: 1rem;
top: 50%;
transform: translateY(-50%);
color: var(–text-light);
font-size: 1.2rem;
}.search-tags {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
justify-content: center;
}.search-tag {
background: var(–bg-tertiary);
color: var(–text-light);
padding: 0.4rem 0.8rem;
border-radius: 20px;
font-size: 0.8rem;
cursor: pointer;
transition: var(–transition);
}.search-tag:hover {
background: var(–primary-color);
color: white;
}/* Language Filter */
.language-filter {
display: flex;
justify-content: center;
margin-bottom: 1rem;
padding: 0.5rem;
background: #eff6ff;
border-radius: var(–border-radius);
border: 1px solid #3b82f6;
}.language-indicator {
display: flex;
align-items: center;
gap: 0.5rem;
color: #1e40af;
font-size: 0.9rem;
font-weight: 600;
}/* Navigation Categories */
.categories-nav {
background: var(–bg-primary);
padding: 2rem 0;
border-bottom: 1px solid #e5e7eb;
}.categories-title {
text-align: center;
font-size: 2rem;
font-weight: 700;
margin-bottom: 2rem;
color: var(–text-dark);
}.categories-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 1.5rem;
margin-top: 2rem;
}.category-card {
background: white;
border-radius: var(–border-radius);
padding: 2rem;
box-shadow: var(–shadow-md);
border: 2px solid transparent;
transition: var(–transition);
cursor: pointer;
position: relative;
overflow: hidden;
}.category-card::before {
content: »;
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4px;
background: var(–gradient-primary);
transform: scaleX(0);
transition: var(–transition);
}.category-card:hover {
transform: translateY(-4px);
box-shadow: var(–shadow-xl);
border-color: var(–primary-color);
}.category-card:hover::before {
transform: scaleX(1);
}.category-icon {
width: 60px;
height: 60px;
background: var(–gradient-primary);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 1.5rem;
font-size: 1.8rem;
color: white;
}.category-title {
font-size: 1.3rem;
font-weight: 700;
margin-bottom: 0.8rem;
color: var(–text-dark);
}.category-description {
color: var(–text-light);
font-size: 0.95rem;
line-height: 1.5;
margin-bottom: 1rem;
}.category-count {
background: var(–bg-tertiary);
color: var(–text-light);
padding: 0.3rem 0.8rem;
border-radius: 20px;
font-size: 0.8rem;
font-weight: 600;
}/* Latest Posts Section */
.latest-posts-section {
background: var(–bg-secondary);
padding: 4rem 0;
}.section-header {
text-align: center;
margin-bottom: 3rem;
}.section-title {
font-size: 2.5rem;
font-weight: 800;
margin-bottom: 1rem;
background: var(–gradient-primary);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}.section-subtitle {
font-size: 1.2rem;
color: var(–text-light);
max-width: 600px;
margin: 0 auto;
}.posts-carousel-container {
position: relative;
overflow: hidden;
margin-bottom: 3rem;
}.posts-carousel {
display: flex;
gap: 2rem;
transition: transform 0.5s ease;
padding: 0 1rem;
}.post-card {
background: white;
border-radius: var(–border-radius);
box-shadow: var(–shadow-md);
overflow: hidden;
min-width: 350px;
flex: 0 0 350px;
transition: var(–transition);
cursor: pointer;
text-decoration: none;
color: inherit;
}.post-card:hover {
transform: translateY(-8px);
box-shadow: var(–shadow-xl);
text-decoration: none;
color: inherit;
}.post-image {
width: 100%;
height: 200px;
background: var(–gradient-accent);
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 3rem;
position: relative;
overflow: hidden;
background-size: cover;
background-position: center;
}.post-image.no-image {
background: var(–gradient-accent);
}.post-image::before {
content: »;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: url(‘data:image/svg+xml,
‘);
opacity: 0.3;
}.post-content {
padding: 1.5rem;
}.post-category {
background: var(–primary-color);
color: white;
padding: 0.3rem 0.8rem;
border-radius: 15px;
font-size: 0.8rem;
font-weight: 600;
margin-bottom: 1rem;
display: inline-block;
}.post-title {
font-size: 1.3rem;
font-weight: 700;
margin-bottom: 0.8rem;
color: var(–text-dark);
line-height: 1.3;
}.post-excerpt {
color: var(–text-light);
font-size: 0.9rem;
line-height: 1.5;
margin-bottom: 1rem;
}.post-meta {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 0.8rem;
color: var(–text-muted);
}.carousel-controls {
display: flex;
justify-content: center;
gap: 1rem;
margin-top: 2rem;
}.carousel-btn {
background: white;
border: 2px solid var(–primary-color);
color: var(–primary-color);
width: 50px;
height: 50px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: var(–transition);
font-size: 1.2rem;
}.carousel-btn:hover {
background: var(–primary-color);
color: white;
transform: scale(1.1);
}.carousel-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
transform: none;
}/* Loading state for posts */
.posts-loading {
display: flex;
justify-content: center;
align-items: center;
padding: 4rem 0;
color: var(–text-light);
}.loading-spinner {
width: 40px;
height: 40px;
border: 4px solid #f3f3f3;
border-top: 4px solid var(–primary-color);
border-radius: 50%;
animation: spin 1s linear infinite;
margin-right: 1rem;
}@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}.posts-error {
text-align: center;
padding: 2rem;
color: var(–error-color);
background: #fef2f2;
border-radius: var(–border-radius);
margin: 2rem 0;
}/* Downloadable Guides Section */
.guides-section {
background: var(–bg-primary);
padding: 4rem 0;
}.guides-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
margin-top: 3rem;
}.guide-card {
background: white;
border-radius: var(–border-radius);
box-shadow: var(–shadow-md);
overflow: hidden;
transition: var(–transition);
border: 2px solid transparent;
}.guide-card:hover {
transform: translateY(-6px);
box-shadow: var(–shadow-xl);
border-color: var(–accent-color);
}.guide-cover {
width: 100%;
height: 250px;
background: var(–gradient-secondary);
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 4rem;
position: relative;
overflow: hidden;
}.guide-cover::before {
content: »;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: url(‘data:image/svg+xml,
‘);
opacity: 0.4;
}.guide-info {
padding: 2rem;
}.guide-title {
font-size: 1.4rem;
font-weight: 700;
margin-bottom: 1rem;
color: var(–text-dark);
line-height: 1.3;
}.guide-description {
color: var(–text-light);
font-size: 0.95rem;
line-height: 1.5;
margin-bottom: 1.5rem;
}.guide-stats {
display: flex;
gap: 1rem;
margin-bottom: 1.5rem;
font-size: 0.8rem;
color: var(–text-muted);
}.guide-stat {
display: flex;
align-items: center;
gap: 0.3rem;
}.download-btn {
background: var(–accent-color);
color: white;
padding: 0.8rem 1.5rem;
border: none;
border-radius: var(–border-radius);
font-weight: 600;
cursor: pointer;
transition: var(–transition);
width: 100%;
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
}.download-btn:hover {
background: #d97706;
transform: translateY(-2px);
box-shadow: var(–shadow-md);
}/* Newsletter Section */
.newsletter-section {
background: var(–gradient-primary);
color: white;
padding: 4rem 0;
position: relative;
overflow: hidden;
}.newsletter-section::before {
content: »;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: url(‘data:image/svg+xml,
‘);
opacity: 0.3;
}.newsletter-content {
position: relative;
z-index: 2;
text-align: center;
max-width: 600px;
margin: 0 auto;
}.newsletter-title {
font-size: 2.5rem;
font-weight: 800;
margin-bottom: 1rem;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}.newsletter-description {
font-size: 1.1rem;
margin-bottom: 2.5rem;
opacity: 0.95;
line-height: 1.6;
}.newsletter-form {
display: flex;
gap: 1rem;
max-width: 500px;
margin: 0 auto;
flex-wrap: wrap;
}.newsletter-input {
flex: 1;
min-width: 250px;
padding: 1rem;
border: 2px solid rgba(255,255,255,0.3);
border-radius: var(–border-radius);
background: rgba(255,255,255,0.1);
color: white;
font-size: 1rem;
backdrop-filter: blur(10px);
}.newsletter-input::placeholder {
color: rgba(255,255,255,0.8);
}.newsletter-input:focus {
outline: none;
border-color: rgba(255,255,255,0.6);
background: rgba(255,255,255,0.2);
}.newsletter-btn {
background: var(–accent-color);
color: white;
padding: 1rem 2rem;
border: none;
border-radius: var(–border-radius);
font-weight: 600;
cursor: pointer;
transition: var(–transition);
min-width: 150px;
}.newsletter-btn:hover {
background: #d97706;
transform: translateY(-2px);
box-shadow: var(–shadow-md);
}/* Action Buttons */
.action-section {
background: var(–bg-secondary);
padding: 3rem 0;
}.action-buttons {
display: flex;
gap: 2rem;
justify-content: center;
flex-wrap: wrap;
}.action-btn {
background: white;
color: var(–text-dark);
padding: 1.2rem 2rem;
border: 2px solid var(–primary-color);
border-radius: var(–border-radius);
font-weight: 700;
text-decoration: none;
transition: var(–transition);
display: flex;
align-items: center;
gap: 0.8rem;
font-size: 1.1rem;
box-shadow: var(–shadow-md);
}.action-btn:hover {
background: var(–primary-color);
color: white;
transform: translateY(-3px);
box-shadow: var(–shadow-xl);
text-decoration: none;
}.action-btn.primary {
background: var(–primary-color);
color: white;
}.action-btn.primary:hover {
background: var(–secondary-color);
}/* Footer Contact */
.footer-contact {
background: var(–text-dark);
color: white;
padding: 2rem 0;
text-align: center;
}.footer-contact p {
font-size: 1.1rem;
margin-bottom: 1rem;
}.footer-contact a {
color: var(–accent-color);
text-decoration: none;
font-weight: 600;
}.footer-contact a:hover {
text-decoration: underline;
}/* Responsive Design */
@media (max-width: 768px) {
.container {
padding: 0 15px;
}.hero-section {
padding: 3rem 0 4rem;
}.hero-title {
font-size: 2.5rem;
}.hero-badges {
flex-direction: column;
align-items: center;
}.categories-grid {
grid-template-columns: 1fr;
}.posts-carousel {
padding: 0 1rem;
}.post-card {
min-width: 300px;
flex: 0 0 300px;
}.guides-grid {
grid-template-columns: 1fr;
}.newsletter-form {
flex-direction: column;
align-items: center;
}.newsletter-input {
min-width: auto;
width: 100%;
}.action-buttons {
flex-direction: column;
align-items: center;
}.action-btn {
width: 100%;
max-width: 300px;
justify-content: center;
}
}/* Accessibility */
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}/* Loading States */
.loading {
opacity: 0.6;
pointer-events: none;
}.skeleton {
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
background-size: 200% 100%;
animation: loading 1.5s infinite;
}@keyframes loading {
0% { background-position: 200% 0; }
100% { background-position: -200% 0; }
}
Centre de Connaissances IA & SEO
Votre quartier général d’apprentissage et de stratégie digitale. À l’avant-garde de l’Intelligence Artificielle et du SEO,
la connaissance n’est pas seulement un pouvoir—c’est la clé de l’adaptation, de l’innovation et du leadership durable.
🧠
Savoir d’abord
🚀
Stratégies innovantes
📚
Ressources gratuites
🎯
Application pratique
Que souhaitez-vous apprendre aujourd’hui ?
🇫🇷
Affichage des articles en français uniquement
🔍
SGE
ChatGPT SEO
Schema Markup
Core Web Vitals
E-E-A-T
Link Building
Explorer par catégorie 🤖
Maîtriser la Recherche IA
Tout sur SGE, l’optimisation pour ChatGPT, Gemini, Perplexity, et comment devenir la source citée par l’IA.
0 articles ⚙️
Ingénierie des Moteurs de Recherche
Plongée approfondie dans le SEO technique, Core Web Vitals, Schema avancé, link building et audits complets.
0 articles 📊
Marketing Intelligent à l’Ère de l’IA
Applications de l’IA dans le marketing de contenu, réseaux sociaux, email, PPC et expérience client.
0 articles 🎯
Stratégies Éprouvées & Résultats
Tactiques actionnables, études de cas , leçons apprises et comment nous appliquons nos connaissances.
0 articles 📈
Actualités Secteur & Outils Digitaux
Mises à jour d’algorithmes, tests d’outils et analyse des dernières tendances du secteur.
0 articles
Chargement des derniers articles… Impossible de charger les articles Nouvelle tentative… En attendant, vous pouvez explorer nos catégories ou vous abonner à notre newsletter.
Réessayer
📋
Check-list Ultime : 50 Points pour Optimiser votre Site pour l’IA
Un guide complet et actionnable avec tous les éléments techniques, de contenu et stratégiques
nécessaires pour que votre site soit parfaitement interprété par l’Intelligence Artificielle.
📄 25 pages
⏱️ Mise en œuvre : 2-4 semaines
🎯 Niveau : Intermédiaire
📥
Bientôt disponible
🗝️
Guide Complet des Mots-clés pour la Recherche Conversationnelle & SGE
Maîtrisez l’art de la recherche de mots-clés dans le contexte des recherches conversationnelles et
de la Search Generative Experience. Inclut modèles et outils.
📄 32 pages
⏱️ Mise en œuvre : 1-2 semaines
🎯 Niveau : Avancé
📥
Bientôt disponible
🏗️
Modèles Pratiques de Schema Markup pour Améliorer vos Citations IA
Collection de modèles de données structurées prêts à l’emploi, optimisés spécifiquement
pour améliorer votre visibilité dans les réponses générées par l’IA.
📄 18 pages
⏱️ Mise en œuvre : 3-5 jours
🎯 Niveau : Intermédiaire
📥
Bientôt disponible
Rejoignez notre communauté d’apprentissage
Abonnez-vous à notre newsletter pour recevoir nos dernières publications,
guides exclusifs et actualités du secteur directement dans votre boîte mail. Soyez les premiers informés des nouvelles ressources et événements.
S’abonner
// Global variables for carousel
let currentSlide = 0;
let blogPosts = [];
let allBlogPosts = []; // Store all posts before filtering
let maxSlide = 0;
const cardsPerView = window.innerWidth > 768 ? 3 : 1;// Function to detect if text is in French
function isFrenchText(text) {
if (!text || typeof text !== ‘string’) return false;
// Clean HTML tags and get plain text
const cleanText = text.replace(/]*>/g, »).trim();
if (cleanText.length
frenchWords.includes(word)
).length;
// Calculate percentage of French words
const frenchPercentage = frenchWordCount / words.length;
// Consider it French if at least 15% are common French words
return frenchPercentage >= 0.15;
}// Function to filter posts by language for French
function filterFrenchPosts(posts) {
return posts.filter(post => {
// Check multiple fields for language detection
const titleIsFrench = isFrenchText(post.title);
const excerptIsFrench = isFrenchText(post.excerpt);
const contentIsFrench = isFrenchText(post.content);
// Check if language is explicitly set to French
if (post.language) {
return post.language === ‘fr’ ||
post.language === ‘french’ ||
post.language === ‘français’ ||
post.language.startsWith(‘fr’);
}
// Check Polylang specific fields
if (post.pll_language) {
return post.pll_language === ‘fr’;
}
// Check slug for French language indicators
if (post.slug) {
const isFrenchSlug = post.slug.includes(‘/fr/’) ||
post.slug.includes(‘-fr-‘) ||
post.slug.includes(‘_fr_’);
if (isFrenchSlug) return true;
// Check for non-French language indicators
const isOtherLangSlug = post.slug.includes(‘/en/’) ||
post.slug.includes(‘/es/’) ||
post.slug.includes(‘-en-‘) ||
post.slug.includes(‘-es-‘);
if (isOtherLangSlug) return false;
}
// Check URL for French language indicators
if (post.link) {
const isFrenchUrl = post.link.includes(‘/fr/’) ||
post.link.includes(‘.fr/’) ||
post.link.includes(‘lang=fr’);
if (isFrenchUrl) return true;
// Check for non-French language indicators in URL
const isOtherLangUrl = post.link.includes(‘/en/’) ||
post.link.includes(‘/es/’) ||
post.link.includes(‘lang=en’) ||
post.link.includes(‘lang=es’);
if (isOtherLangUrl) return false;
}
// Use text detection as fallback
return titleIsFrench || excerptIsFrench || contentIsFrench;
});
}// Function to get icon by category
function getCategoryIcon(category) {
const icons = {
‘recherche-ia’: ‘🤖’,
‘seo-technique’: ‘⚙️’,
‘marketing-ia’: ‘📊’,
‘strategies’: ‘🎯’,
‘actualites-secteur’: ‘📈’,
‘tutoriels’: ‘📚’,
‘outils’: ‘🔧’,
‘etudes-cas’: ‘📈’,
// English fallbacks
‘ai-search’: ‘🤖’,
‘technical-seo’: ‘⚙️’,
‘ai-marketing’: ‘📊’,
‘industry-news’: ‘📈’
};
return icons[category] || ‘📝’;
}// Function to format date in French
function formatDate(dateString) {
const options = {
year: ‘numeric’,
month: ‘long’,
day: ‘numeric’
};
return new Date(dateString).toLocaleDateString(‘fr-FR’, options);
}// Function to calculate reading time in French
function calculateReadingTime(content) {
const wordsPerMinute = 200;
const wordCount = content.split(‘ ‘).length;
const readingTime = Math.ceil(wordCount / wordsPerMinute);
return `${readingTime} min de lecture`;
}// Function to truncate text
function truncateText(text, maxLength = 150) {
if (text.length <= maxLength) return text;
return text.substr(0, maxLength) + '…';
}// Function to create a post card
function createPostCard(post) {
const postCard = document.createElement('a');
postCard.className = 'post-card';
postCard.href = post.link || '#';
// Determine image
const imageHTML = post.featured_image
? `
`
: `
${getCategoryIcon(post.category)}
`;postCard.innerHTML = `
${imageHTML}
${post.category_name || ‘Blog’} ${post.title} ${truncateText(post.excerpt || »)}
📅 ${formatDate(post.date)}
⏱️ ${post.reading_time || calculateReadingTime(post.content || post.excerpt || »)}
`;return postCard;
}// Function to load blog posts optimized for Polylang
async function loadBlogPosts() {
const loadingElement = document.getElementById(‘postsLoading’);
const errorElement = document.getElementById(‘postsError’);
const carouselContainer = document.getElementById(‘postsCarouselContainer’);
const carousel = document.getElementById(‘postsCarousel’);try {
// Show loading
loadingElement.style.display = ‘flex’;
errorElement.style.display = ‘none’;
carouselContainer.style.display = ‘none’;// Try to load from WordPress API with Polylang support
let posts = [];
// Polylang-specific endpoints (Polylang uses ?lang=fr parameter)
const possibleEndpoints = [
‘/wp-json/wp/v2/posts?per_page=20&_embed&lang=fr’,
‘/wp-json/wp/v2/posts?per_page=20&lang=fr’,
‘/fr/wp-json/wp/v2/posts?per_page=20&_embed’,
‘/wp-json/wp/v2/posts?per_page=20&_embed’,
‘/wp-json/wp/v2/posts?per_page=20’,
‘/blog/wp-json/wp/v2/posts?per_page=20&_embed&lang=fr’,
‘/blog/wp-json/wp/v2/posts?per_page=20&_embed’
];for (const endpoint of possibleEndpoints) {
try {
const response = await fetch(endpoint);
if (response.ok) {
const data = await response.json();
posts = data.map(post => ({
id: post.id,
title: post.title.rendered,
excerpt: post.excerpt.rendered.replace(/]*>/g, »),
content: post.content?.rendered || »,
link: post.link,
slug: post.slug,
date: post.date,
language: post.language || post.lang || post.pll_language || null,
pll_language: post.pll_language || null,
featured_image: post._embedded?.[‘wp:featuredmedia’]?.[0]?.source_url ||
post.featured_media_url || null,
category: post.categories?.[0] || ‘general’,
category_name: post._embedded?.[‘wp:term’]?.[0]?.[0]?.name || ‘Blog’
}));
break;
}
} catch (err) {
console.log(`Error with endpoint ${endpoint}:`, err);
continue;
}
}// Store all posts
allBlogPosts = posts;// If no posts found from API, use French example posts
if (posts.length === 0) {
posts = [
{
id: 1,
title: « Comment optimiser votre contenu pour SGE : Guide complet 2024 »,
excerpt: « Découvrez les stratégies les plus efficaces pour apparaître dans Search Generative Experience et être cité par l’IA de Google. »,
content: « Search Generative Experience représente l’avenir de la recherche, où l’intelligence artificielle génère des réponses complètes… »,
link: « # »,
date: new Date().toISOString(),
language: « fr »,
category: « recherche-ia »,
category_name: « Recherche IA »,
featured_image: null
},
{
id: 2,
title: « Core Web Vitals 2024 : Ce qui compte vraiment pour votre classement »,
excerpt: « Analyse approfondie des métriques d’expérience utilisateur que Google privilégie cette année. »,
content: « Les Core Web Vitals continuent d’être des facteurs de classement cruciaux dans l’algorithme de Google… »,
link: « # »,
date: new Date(Date.now() – 86400000).toISOString(),
language: « fr »,
category: « seo-technique »,
category_name: « SEO Technique »,
featured_image: null
},
{
id: 3,
title: « E-E-A-T à l’ère de l’IA : Construire une autorité qui conquiert les algorithmes »,
excerpt: « Stratégies pratiques pour démontrer expertise, autorité et fiabilité dans votre contenu. »,
content: « Expérience, Expertise, Autorité et Fiabilité (E-E-A-T) sont devenus plus importants que jamais… »,
link: « # »,
date: new Date(Date.now() – 172800000).toISOString(),
language: « fr »,
category: « strategies »,
category_name: « Stratégies »,
featured_image: null
},
{
id: 4,
title: « Top 10 des outils IA que tout SEO devrait connaître en 2024 »,
excerpt: « Revue complète des outils d’Intelligence Artificielle qui révolutionnent le SEO. »,
content: « Le paysage SEO évolue rapidement avec des outils alimentés par l’IA qui peuvent considérablement améliorer votre flux de travail… »,
link: « # »,
date: new Date(Date.now() – 259200000).toISOString(),
language: « fr »,
category: « actualites-secteur »,
category_name: « Outils »,
featured_image: null
},
{
id: 5,
title: « Schema Markup pour l’IA : Données structurées qui fonctionnent »,
excerpt: « Apprenez à implémenter le Schema Markup optimisé pour l’IA pour mieux faire comprendre votre contenu. »,
content: « Le balisage Schema est devenu essentiel pour aider les systèmes d’IA à comprendre et catégoriser efficacement votre contenu… »,
link: « # »,
date: new Date(Date.now() – 345600000).toISOString(),
language: « fr »,
category: « seo-technique »,
category_name: « SEO Technique »,
featured_image: null
},
{
id: 6,
title: « Marketing conversationnel : Stratégies pour l’ère ChatGPT »,
excerpt: « Comment adapter votre stratégie marketing pour un monde où les conversations IA sont la norme. »,
content: « L’IA conversationnelle change la façon dont les marques interagissent avec les clients… »,
link: « # »,
date: new Date(Date.now() – 432000000).toISOString(),
language: « fr »,
category: « marketing-ia »,
category_name: « Marketing IA »,
featured_image: null
}
];
allBlogPosts = posts;
}// Filter for French posts only
const frenchPosts = filterFrenchPosts(allBlogPosts);
console.log(`Chargé ${allBlogPosts.length} posts au total, ${frenchPosts.length} posts en français`);blogPosts = frenchPosts;
renderPosts(frenchPosts);
updateCategoryCounters(frenchPosts);
// Hide loading and show carousel
loadingElement.style.display = ‘none’;
carouselContainer.style.display = ‘block’;
// Initialize carousel
updateCarousel();} catch (error) {
console.error(‘Erreur lors du chargement des posts:’, error);
loadingElement.style.display = ‘none’;
errorElement.style.display = ‘block’;
}
}// Function to render posts
function renderPosts(posts) {
const carousel = document.getElementById(‘postsCarousel’);
carousel.innerHTML = »;if (posts.length === 0) {
carousel.innerHTML = `
Aucun article français trouvé Nous travaillons à ajouter plus de contenu en français. Revenez bientôt !
`;
return;
}posts.forEach(post => {
const postCard = createPostCard(post);
carousel.appendChild(postCard);
});maxSlide = Math.max(0, posts.length – cardsPerView);
}// Function to update category counters
function updateCategoryCounters(posts) {
const categoryCounts = {};
posts.forEach(post => {
const category = post.category || ‘general’;
categoryCounts[category] = (categoryCounts[category] || 0) + 1;
});// Update counters in UI
Object.keys(categoryCounts).forEach(category => {
const countElement = document.getElementById(`count-${category}`);
if (countElement) {
const count = categoryCounts[category];
countElement.textContent = `${count} article${count !== 1 ? ‘s’ : »}`;
}
});// Set 0 for categories without posts
const allCategories = [‘recherche-ia’, ‘seo-technique’, ‘marketing-ia’, ‘strategies’, ‘actualites-secteur’];
allCategories.forEach(category => {
if (!categoryCounts[category]) {
const countElement = document.getElementById(`count-${category}`);
if (countElement) {
countElement.textContent = ‘0 articles’;
}
}
});
}// Function to move carousel
function moveCarousel(direction) {
currentSlide += direction;
if (currentSlide maxSlide) currentSlide = maxSlide;
updateCarousel();
}// Function to update carousel position
function updateCarousel() {
const carousel = document.getElementById(‘postsCarousel’);
if (!carousel) return;const translateX = -(currentSlide * (100 / cardsPerView));
carousel.style.transform = `translateX(${translateX}%)`;
// Update button states
const prevBtn = document.getElementById(‘prevBtn’);
const nextBtn = document.getElementById(‘nextBtn’);
if (prevBtn) prevBtn.disabled = currentSlide === 0;
if (nextBtn) nextBtn.disabled = currentSlide >= maxSlide;
}// Function for search (only search in French posts)
function performSearch(query) {
if (!query.trim()) return;const filteredPosts = blogPosts.filter(post =>
post.title.toLowerCase().includes(query.toLowerCase()) ||
post.excerpt.toLowerCase().includes(query.toLowerCase()) ||
post.category_name.toLowerCase().includes(query.toLowerCase())
);if (filteredPosts.length > 0) {
renderPosts(filteredPosts);
currentSlide = 0;
updateCarousel();
} else {
// Show no results message
const carousel = document.getElementById(‘postsCarousel’);
carousel.innerHTML = `
Aucun résultat trouvé Aucun article français ne correspond à « ${query} »
Afficher tous les articles français
`;
}
}// Function to show all posts (French only)
function showAllPosts() {
renderPosts(blogPosts);
currentSlide = 0;
updateCarousel();
document.getElementById(‘searchInput’).value = »;
}// Function to handle newsletter subscription
function handleNewsletterSubmit(event) {
event.preventDefault();
const email = event.target.querySelector(‘input[type= »email »]’).value;
const button = event.target.querySelector(‘.newsletter-btn’);
const originalText = button.textContent;
button.textContent = ‘Abonnement…’;
button.disabled = true;
// Simulate submission (here you would integrate with your email service)
setTimeout(() => {
alert(`Merci de vous être abonné !\n\nEmail : ${email}\n\nVous recevrez notre première newsletter avec les derniers articles et ressources exclusives.`);
button.textContent = originalText;
button.disabled = false;
event.target.reset();
}, 2000);
}// Event Listeners
document.addEventListener(‘DOMContentLoaded’, function() {
// Load blog posts
loadBlogPosts();// Configure search
const searchInput = document.getElementById(‘searchInput’);
const searchTags = document.querySelectorAll(‘.search-tag’);
if (searchInput) {
searchInput.addEventListener(‘keypress’, function(e) {
if (e.key === ‘Enter’) {
performSearch(this.value);
}
});
}
searchTags.forEach(tag => {
tag.addEventListener(‘click’, function() {
if (searchInput) {
searchInput.value = this.textContent;
performSearch(this.textContent);
}
});
});// Configure categories (filter French posts only)
const categoryCards = document.querySelectorAll(‘.category-card’);
categoryCards.forEach(card => {
card.addEventListener(‘click’, function() {
const category = this.getAttribute(‘data-category’);
const filteredPosts = blogPosts.filter(post => post.category === category);
if (filteredPosts.length > 0) {
renderPosts(filteredPosts);
currentSlide = 0;
updateCarousel();
// Scroll to posts section
document.querySelector(‘.latest-posts-section’).scrollIntoView({
behavior: ‘smooth’
});
} else {
alert(`Catégorie : ${this.querySelector(‘.category-title’).textContent}\n\nAucun article français dans cette catégorie pour le moment. Plus de contenu bientôt !`);
}
});
});// Auto-play carousel
setInterval(() => {
if (blogPosts.length > cardsPerView) {
if (currentSlide >= maxSlide) {
currentSlide = 0;
} else {
currentSlide++;
}
updateCarousel();
}
}, 5000);// Responsive handling
window.addEventListener(‘resize’, function() {
const newCardsPerView = window.innerWidth > 768 ? 3 : 1;
if (newCardsPerView !== cardsPerView) {
maxSlide = Math.max(0, blogPosts.length – newCardsPerView);
currentSlide = Math.min(currentSlide, maxSlide);
updateCarousel();
}
});
});// Handle guide downloads
document.addEventListener(‘DOMContentLoaded’, function() {
const downloadBtns = document.querySelectorAll(‘.download-btn’);
downloadBtns.forEach(btn => {
btn.addEventListener(‘click’, function() {
const originalContent = this.innerHTML;
this.innerHTML = ‘
📥 Préparation… ‘;
this.disabled = true;
this.classList.add(‘loading’);
setTimeout(() => {
alert(‘Ce guide sera bientôt disponible.\n\nAbonnez-vous à notre newsletter pour être notifié quand il sera prêt !’);
this.innerHTML = originalContent;
this.disabled = false;
this.classList.remove(‘loading’);
}, 1500);
});
});
});