|
| 1 | +# Linagora Engineering Blog |
| 2 | + |
| 3 | +Le blog d'ingénierie de Linagora — articles techniques bilingues (FR / EN) générés statiquement à partir de fichiers Markdown. |
| 4 | + |
| 5 | +> _The Linagora engineering blog — bilingual (FR/EN) technical articles, statically generated from Markdown files._ |
| 6 | +
|
| 7 | +--- |
| 8 | + |
| 9 | +## Stack |
| 10 | + |
| 11 | +- [**Astro 5**](https://astro.build) — generateur statique |
| 12 | +- [**Tailwind CSS 4**](https://tailwindcss.com) — styling via tokens CSS |
| 13 | +- [**MDX**](https://mdxjs.com) — Markdown enrichi pour les articles |
| 14 | +- [**Shiki**](https://shiki.style) — coloration syntaxique |
| 15 | +- [**Pagefind**](https://pagefind.app) — recherche full-text côté client |
| 16 | +- **TypeScript** strict partout |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## Démarrage rapide |
| 21 | + |
| 22 | +```bash |
| 23 | +npm install |
| 24 | +npm run dev # http://localhost:4321 |
| 25 | +npm run build # build statique + index Pagefind dans dist/ |
| 26 | +npm run preview # serveur local pour tester le build |
| 27 | +``` |
| 28 | + |
| 29 | +> En `dev`, l'index de recherche Pagefind n'est pas généré : la recherche affiche un fallback. |
| 30 | +> Pour la tester en local, faire `npm run build && npm run preview`. |
| 31 | +
|
| 32 | +--- |
| 33 | + |
| 34 | +## Écrire un article |
| 35 | + |
| 36 | +### 1. Nommage du fichier |
| 37 | + |
| 38 | +``` |
| 39 | +src/content/posts/<slug>.<lang>.md |
| 40 | +``` |
| 41 | + |
| 42 | +- `<slug>` : url-friendly, en kebab-case, **identique entre FR et EN** pour lier les traductions. |
| 43 | +- `<lang>` : `fr` ou `en`. |
| 44 | + |
| 45 | +Exemples : |
| 46 | + |
| 47 | +``` |
| 48 | +src/content/posts/migrer-vers-astro.fr.md |
| 49 | +src/content/posts/migrer-vers-astro.en.md |
| 50 | +src/content/posts/post-mortem-incident-mai.fr.md # FR uniquement, OK |
| 51 | +``` |
| 52 | + |
| 53 | +Un article qui n'existe que dans une langue **n'apparaîtra pas dans la liste de l'autre langue** et le bouton de switch sera désactivé. |
| 54 | + |
| 55 | +### 2. Frontmatter |
| 56 | + |
| 57 | +```yaml |
| 58 | +--- |
| 59 | +title: Mon super article |
| 60 | +description: Un résumé court (~160 caractères) qui sert pour le SEO et les cards. |
| 61 | +date: 2026-05-04 # ISO date (obligatoire) |
| 62 | +updated: 2026-06-01 # optionnel |
| 63 | +authors: [linagora-team] # IDs de fichiers dans src/content/authors/ (au moins 1) |
| 64 | +tags: [astro, devops] # optionnel |
| 65 | +cover: /covers/mon-article.jpg # optionnel — chemin dans public/ |
| 66 | +coverAlt: Description alt # recommandé si cover |
| 67 | +draft: false # optionnel, défaut false |
| 68 | +--- |
| 69 | +``` |
| 70 | + |
| 71 | +### 3. Corps |
| 72 | + |
| 73 | +Markdown standard ou MDX. Coloration syntaxique automatique : |
| 74 | + |
| 75 | +````markdown |
| 76 | +```ts |
| 77 | +const hello = (name: string) => `Hello ${name}!`; |
| 78 | +``` |
| 79 | +```` |
| 80 | + |
| 81 | +### 4. Ajouter un auteur |
| 82 | + |
| 83 | +``` |
| 84 | +src/content/authors/<id>.md |
| 85 | +``` |
| 86 | + |
| 87 | +```yaml |
| 88 | +--- |
| 89 | +name: Jane Doe |
| 90 | +title: Senior Software Engineer |
| 91 | +bio: Une bio courte. |
| 92 | +avatar: /authors/jane-doe.jpg # optionnel, dans public/ |
| 93 | +github: janedoe # optionnel |
| 94 | +linkedin: janedoe # optionnel (slug LinkedIn) |
| 95 | +mastodon: https://floss.social/@janedoe |
| 96 | +website: https://janedoe.dev |
| 97 | +--- |
| 98 | +``` |
| 99 | + |
| 100 | +Référencez l'auteur dans le frontmatter de votre article : `authors: [jane-doe]`. |
| 101 | + |
| 102 | +### 5. Workflow |
| 103 | + |
| 104 | +1. **Forkez** le dépôt (ou créez une branche si vous avez les droits) |
| 105 | +2. **Ajoutez** votre/vos fichier(s) `.md` |
| 106 | +3. **Testez** localement : `npm run build` |
| 107 | +4. **Ouvrez une Pull Request** vers `main` |
| 108 | + |
| 109 | +La CI valide le build et le typecheck. Après merge sur `main`, l'image Docker est publiée sur GHCR. |
| 110 | + |
| 111 | +--- |
| 112 | + |
| 113 | +## Structure du projet |
| 114 | + |
| 115 | +``` |
| 116 | +src/ |
| 117 | +├── content/ |
| 118 | +│ ├── posts/ # ← articles .md (un par langue) |
| 119 | +│ └── authors/ # ← profils auteurs |
| 120 | +├── content.config.ts # schémas Zod (frontmatter) |
| 121 | +├── i18n/ # strings UI + helpers de routing |
| 122 | +├── layouts/ # Base + Post layouts |
| 123 | +├── components/ # composants Astro réutilisables |
| 124 | +├── pages/[lang]/ # pages dynamiques par langue |
| 125 | +├── lib/posts.ts # helpers de requête sur la collection |
| 126 | +├── styles/global.css # tokens CSS + styles prose |
| 127 | +└── site.config.ts # nom, URL, infos du repo GitHub |
| 128 | +``` |
| 129 | + |
| 130 | +--- |
| 131 | + |
| 132 | +## Personnaliser |
| 133 | + |
| 134 | +| Quoi | Où | |
| 135 | +|---|---| |
| 136 | +| Nom du blog, repo GitHub, URLs sociaux | `src/site.config.ts` | |
| 137 | +| Tokens couleur, typo, dark mode | `src/styles/global.css` | |
| 138 | +| Strings d'interface (FR/EN) | `src/i18n/ui.ts` | |
| 139 | +| Page À propos | `src/pages/[lang]/about.astro` | |
| 140 | +| Logo / favicon | `public/favicon.svg` | |
| 141 | +| Image OG par défaut | `public/og-default.svg` _(remplaçable par `.png` 1200×630)_ | |
| 142 | + |
| 143 | +--- |
| 144 | + |
| 145 | +## Déploiement |
| 146 | + |
| 147 | +### Image Docker |
| 148 | + |
| 149 | +```bash |
| 150 | +docker build -t linagora/engineering-blog:latest . |
| 151 | +docker run -p 8080:8080 linagora/engineering-blog:latest |
| 152 | +``` |
| 153 | + |
| 154 | +L'image expose le site sur le port `8080` via nginx. |
| 155 | + |
| 156 | +### CI/CD |
| 157 | + |
| 158 | +Le workflow `.github/workflows/deploy.yml` builde et pousse l'image sur **GHCR** (`ghcr.io/linagora/engineering-blog`) à chaque push sur `main`. |
| 159 | + |
| 160 | +**À brancher sur l'infra Linagora** (étape laissée en TODO dans le workflow) : |
| 161 | +- Soit SSH + `docker compose pull && docker compose up -d` |
| 162 | +- Soit `kubectl set image` sur un Deployment Kubernetes |
| 163 | +- Soit webhook vers un orchestrateur interne |
| 164 | + |
| 165 | +### Variables / configuration |
| 166 | + |
| 167 | +| Endroit | Quoi | |
| 168 | +|---|---| |
| 169 | +| `src/site.config.ts` | URL canonique du site (modifie `SITE.url`), org/repo GitHub pour les liens "Edit on GitHub" | |
| 170 | +| `astro.config.ts` | Config i18n, redirects, intégrations | |
| 171 | + |
| 172 | +--- |
| 173 | + |
| 174 | +## Recherche |
| 175 | + |
| 176 | +Pagefind indexe le contenu balisé `data-pagefind-body` (= chaque article). L'index est généré à la fin de `npm run build` dans `dist/pagefind/`. |
| 177 | + |
| 178 | +Le filtre par langue est automatique : Pagefind respecte l'attribut `lang` du `<html>` de chaque page. |
| 179 | + |
| 180 | +Raccourci : <kbd>⌘K</kbd> / <kbd>Ctrl+K</kbd>. |
| 181 | + |
| 182 | +--- |
| 183 | + |
| 184 | +## Licence |
| 185 | + |
| 186 | +Le code de ce blog est sous licence [AGPL-3.0]. Les articles publiés appartiennent à leurs auteurs et sont diffusés sous [CC BY-SA 4.0] sauf mention contraire dans le frontmatter (`license: ...`). |
| 187 | + |
| 188 | +[AGPL-3.0]: https://www.gnu.org/licenses/agpl-3.0.html |
| 189 | +[CC BY-SA 4.0]: https://creativecommons.org/licenses/by-sa/4.0/ |
0 commit comments