refactor: update README for improved clarity and organization

This commit is contained in:
Cheick Oumar 2026-05-21 00:34:26 +02:00
commit d6996e2fe9

214
README.md
View file

@ -1,108 +1,115 @@
# TheAfriForge - Guide Local et Production
Ce projet est un site statique Hugo multilingue :
- Francais par defaut sur /
- Anglais sur /en/
---
## 1) Prerequis
# TheAfriForge
Installe les outils suivants :
- Hugo Extended (recommande: version recente)
**TheAfriForge** est un site statique multilingue (Français/Anglais) construit avec Hugo, dédié à la valorisation des initiatives africaines, à la transparence et à la collaboration.
## 🌍 Présentation
- **Site principal** : [theafriforge.org](https://theafriforge.org/)
- **Organisation** : TheAfriForge
- **Langues** : Français (par défaut), Anglais (`/en/`)
- **Code source** : [GitForge](https://gitforge.africa/TheAfriForge/website.git)
- **Contact** : [@theafriforge](https://twitter.com/theafriforge)
## 🚀 Prérequis
- [Hugo Extended](https://gohugo.io/getting-started/installing/) (version récente recommandée)
- Git
- (Optionnel) Python 3 ou Node.js pour tester la build
Verification rapide :
## 🔧 Installation & Lancement local
```bash
hugo version
git --version
```
## 2) Lancer le site en local
Depuis le dossier du projet :
```bash
cd /home/choudi/Bureau/Projets/Open-Ivoire/Clients/TheAfricaForge
git clone https://gitforge.africa/TheAfriForge/website.git
cd website
hugo server --config ./hugo.toml -D
```
Ensuite ouvre :
- http://localhost:1313/
- http://localhost:1313/en/
## ⚙️ Configuration de l'environnement
Notes :
- L'option -D permet d'afficher aussi les contenus draft.
- Si tu ne veux pas les drafts, retire -D.
## 3) Erreur frequente: hugo server exit code 255
Si le serveur ne demarre pas et retourne 255, verifie :
1. Un processus Hugo deja lance
Avant de lancer le projet, copie le fichier `.env.example` en `.env` et adapte les variables à ton contexte :
```bash
pkill -f "hugo server" || true
cp .env.example .env
# puis édite .env selon tes besoins
```
2. Presence du lock file dans le dossier projet
Exemple de variables (remplace par tes propres valeurs) :
```env
# Endpoint du formulaire dadhésion
HUGO_MEMBERSHIP_FORM_ACTION=https://exemple-endpoint
# Formbricks SDK (recommandé)
HUGO_FORMBRICKS_API_HOST=https://exemple-formbricks
HUGO_FORMBRICKS_ENV_ID=xxxxxxx
HUGO_FORMBRICKS_EVENT=membership_form_submitted
HUGO_FORMBRICKS_SDK_URL=https://exemple-formbricks/js/formbricks.umd.cjs
# Redirection après succès (optionnel)
HUGO_MEMBERSHIP_FORM_SUCCESS_PATH=/chemin-de-redirection
```
## 🐳 Utilisation avec Docker
Pour lancer le site localement avec Docker :
```bash
rm -f .hugo_build.lock
docker build -t theafriforge .
docker run -p 1313:1313 theafriforge
```
3. Relance ensuite le serveur
Le site sera accessible sur [http://localhost:1313/](http://localhost:1313/).
```bash
hugo server --config ./hugo.toml -D
```
Pour la production, adapte la commande de build selon tes besoins (voir le Dockerfile).
## 4) Build de production
- Accès local : [http://localhost:1313/](http://localhost:1313/) (FR), [http://localhost:1313/en/](http://localhost:1313/en/) (EN)
- Loption `-D` affiche aussi les contenus en brouillon.
Genere les fichiers statiques optimises dans public/ :
## 🏗️ Structure du projet
- `content/fr/` et `content/en/` : Contenus en français et anglais
- `layouts/` : Templates Hugo
- `static/` : Fichiers statiques (images, etc.)
- `public/` : Build de production générée
- `hugo.toml` : Configuration principale
## 🛠️ Commandes utiles
- Build de production :
```bash
hugo --config ./hugo.toml --environment production --minify
```
Le dossier de sortie a deployer est :
- public/
## 5) Tester la build de production en local
Option A (Python, simple) :
- Nettoyage du cache Hugo :
```bash
python3 -m http.server 8080 --directory public
rm -rf resources/_gen
```
- Forcer un autre port local :
```bash
hugo server --config ./hugo.toml -D --port 1314
```
Option B (Node) :
## 🐞 Dépannage
```bash
npx serve public
```
- Si `hugo server` retourne le code 255 :
- Arrêter les processus Hugo : `pkill -f "hugo server" || true`
- Supprimer `.hugo_build.lock` : `rm -f .hugo_build.lock`
- Relancer le serveur.
Puis ouvre :
- http://localhost:8080/ (Python)
- URL affichee par serve (Node)
## 🚢 Déploiement
## 6) Deploiement en production
### Option 1 - VPS + Nginx (recommande pour controle complet)
1. Build local :
### Option 1 : VPS + Nginx
1. Générer la build :
```bash
hugo --config ./hugo.toml --environment production --minify
```
2. Copier public/ vers le serveur :
2. Copier le dossier `public/` sur le serveur :
```bash
rsync -avz --delete public/ user@ton-serveur:/var/www/theafriforge/
rsync -avz --delete public/ user@serveur:/var/www/theafriforge/
```
3. Config Nginx minimale :
3. Configurer Nginx (voir exemple ci-dessous) :
```nginx
server {
listen 80;
@ -116,72 +123,15 @@ server {
}
}
```
4. Activer HTTPS (Certbot recommandé).
4. Activer HTTPS via Certbot (recommande).
### Option 2 : Netlify / Cloudflare Pages / Vercel
### Option 2 - Netlify (ultra rapide)
- Build command : `hugo --config ./hugo.toml --environment production --minify`
- Output/Publish directory : `public`
- Sélectionner Hugo Extended si nécessaire.
Build command :
## 📄 Licence
```bash
hugo --config ./hugo.toml --environment production --minify
```
Publish directory :
- public
Important :
- Selectionne Hugo Extended dans les settings de build si necessaire.
### Option 3 - Cloudflare Pages
Build command :
```bash
hugo --config ./hugo.toml --environment production --minify
```
Build output directory :
- public
### Option 4 - Vercel (site statique)
Framework preset :
- Hugo
Build command :
```bash
hugo --config ./hugo.toml --environment production --minify
```
Output directory :
- public
## 7) Workflow recommande
1. Developpement local avec hugo server
2. Verification FR/EN sur / et /en/
3. Build production avec minify
4. Test rapide du dossier public/
5. Deploiement sur hebergeur cible
## 8) Commandes utiles
Build standard :
```bash
hugo --config ./hugo.toml --minify
```
Nettoyage cache Hugo (si comportement etrange) :
```bash
rm -rf resources/_gen
```
Forcer un autre port local :
```bash
hugo server --config ./hugo.toml -D --port 1314
```
Ce projet est open source, voir le dépôt pour plus dinformations.
server_name theafriforge.org www.theafriforge.org;