perf(index.html): LCP preload, picture/WebP, hidden lang-content, drop meta keywords#265
Merged
Conversation
|
|
Copilot
AI
changed the title
[WIP] Optimize performance for index.html based on review
perf(index.html): LCP preload, picture/WebP, hidden lang-content, drop meta keywords
Jun 2, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR applies targeted performance and UX optimizations to index.html to improve LCP/CLS behavior and remove obsolete SEO markup.
Changes:
- Adds an explicit preload for the hero image to start fetching during
<head>parsing. - Wraps the hero image in a
<picture>element (intended WebP fallback) and setsfetchpriority="high"on the hero<img>. - Uses native
hiddenon non-FR.lang-contentblocks and updatesswitchLanguage()to toggleelement.hidden; removes<meta name="keywords">.
Comments suppressed due to low confidence (1)
index.html:71
- Same as the heading: the default French content block should start with
activeso it remains visible once CSS applies.lang-content { display:none; }, even before the JS language switch runs.
<div class="lang-content" data-lang="fr">
<div class="text-lg">
<p class="mt-4">Site officiel de David KRK</p>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…bP source - Add class="lang-content active" to the two default French lang-content blocks to prevent FOUC (flash of invisible content) between CSS load and DOMContentLoaded JS execution - Remove <picture>/<source> WebP element since david_krk_owl.webp does not exist in the repo yet (would cause a 404 and broken hero image in all modern browsers); keep TODO comment and fetchpriority="high" on <img>"
DavidKRK
approved these changes
Jun 2, 2026
Owner
DavidKRK
left a comment
There was a problem hiding this comment.
✅ Les deux problèmes bloquants sont corrigés :
class="lang-content active" ajouté sur les blocs FR par défaut → plus de risque de FOUC entre le chargement CSS et l'exécution JS.
<picture>/<source> WebP supprimé → l'image hero s'affiche correctement sur tous les navigateurs (le fichier .webp n'existant pas encore, il causait une 404 silencieuse).
Le TODO est conservé pour réactiver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four targeted web performance optimisations on
index.htmladdressing LCP, CLS, and SEO hygiene.Changes
LCP — hero image preload (
<head>): adds<link rel="preload" as="image" fetchpriority="high">so the browser fetches the hero image during<head>parsing, before the body is processed.LCP —
<picture>with WebP fallback: wraps the hero<img>in a<picture>element with a WebP<source>. AVIF source deferred until assets are generated (TODO comment left in place). JPG remains the guaranteed fallback.CLS — native
hiddenon non-active lang blocks: all.lang-contentdivs withdata-lang≠frnow carry the HTMLhiddenattribute, preventing a flash of all language blocks before CSS loads.switchLanguage()updated to toggleelement.hiddenalongsideclassList.add/remove('active').SEO — remove
<meta name="keywords">: tag has been ignored by all major search engines for 10+ years; removed.Original prompt
Objectif
Appliquer 4 optimisations de performance Web (LCP / CLS / SEO) sur
index.htmlidentifiées lors de la review de la PR #264.Fichier cible
index.html(branchegh-pages)Changements à effectuer
1. 🔴
preloadde l'image hero dans<head>— Fort impact LCPAjouter cette ligne dans le
<head>, juste avant le CSS principal (<link rel="stylesheet" href="assets/css/style.css">):Cela permet au navigateur de commencer à télécharger l'image hero dès le parsing du
<head>, sans attendre le body.2. 🟠 Utiliser
<picture>avec WebP/AVIF pour l'image hero — Impact LCP + poidsRemplacer :
Par :
Note : les fichiers
.avifet.webpn'existent peut-être pas encore — si c'est le cas, ajouter uniquement la sourcewebpet laisser un commentaire<!-- TODO: générer david_krk_owl.webp et david_krk_owl.avif -->. Le fallback.jpggarantit que rien ne casse.3. 🟡 Attribut
hiddensur leslang-contentnon-FR — Prévention CLSLes blocs
.lang-contentsont masqués via CSS (display: none). Si le CSS est lent à charger, ils apparaissent tous brièvement, causant un CLS. Ajouter l'attribut HTML natifhiddensur tous les blocsdata-langsauffr(qui lui reçoit la classeactivevia JS de toute façon).Tous les
<div class="lang-content" data-lang="...">avecdata-langdifférent defrdoivent recevoir l'attributhidden.Exemple :
classList.add('active')/classList.remove('active')— il faut aussi gérer la suppression de l'attributhiddenlors du switch de langue. Modifier la fonctionswitchLanguagedans le script inline pour retirerhiddendes éléments affichés et l'ajouter aux éléments cachés :4. 🟢 Supprimer
<meta name="keywords">obsolète — Propreté SEOSupprimer cette ligne :
Google et tous les moteurs de recherche modernes ignorent cette balise depuis plus de 10 ans. Sa présence est inutile.
Résultat attendu
hiddennatif sur les blocs de langue non actifsThe following is the prior conversation context from the user's chat exploration (may be truncated):
User: Execute le "submit review" avec ton choix de reponse "Review Event
CommentSubmit general feedback without explicit approval.
ApproveOnly users who did not collaborate with the cloud agent will satisfy review requirements.
Request changesSubmit feedback suggesting changes." et rédire un commentaire pour les review
Assistant: Voici mon analyse complète de la PR, suivie du submit review avec Approve ✅
📋 Résumé de la PR #264
Objectif : Consolider les CSS du sélecteur de langues (suppression des doublons) + optimisation LCP de l'image hero.
Fichiers modifiés : 2 —
assets/css/style.cssetindex.htmlScope : +28 lignes / -66 lignes → nettoyage net du code.
🔍 Analyse des changements
1.
assets/css/style.css— Consolidation CSS 🧹Le problème était clair : les styles de
.language-btnet.lang-contentétaient définis 3 fois à différents endroits du fichier, avec des conflits (!important, valeurs contradictoires). La PR :!important(hack de surcharge inutile)-...
This pull request was created from Copilot chat.