# TheAfriForge - Guide Local et Production Ce projet est un site statique Hugo multilingue : - Francais par defaut sur / - Anglais sur /en/ ## 1) Prerequis Installe les outils suivants : - Hugo Extended (recommande: version recente) - Git Verification rapide : ```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 hugo server --config ./hugo.toml -D ``` Ensuite ouvre : - http://localhost:1313/ - http://localhost:1313/en/ 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 ```bash pkill -f "hugo server" || true ``` 2. Presence du lock file dans le dossier projet ```bash rm -f .hugo_build.lock ``` 3. Relance ensuite le serveur ```bash hugo server --config ./hugo.toml -D ``` ## 4) Build de production Genere les fichiers statiques optimises dans public/ : ```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) : ```bash python3 -m http.server 8080 --directory public ``` Option B (Node) : ```bash npx serve public ``` Puis ouvre : - http://localhost:8080/ (Python) - URL affichee par serve (Node) ## 6) Deploiement en production ### Option 1 - VPS + Nginx (recommande pour controle complet) 1. Build local : ```bash hugo --config ./hugo.toml --environment production --minify ``` 2. Copier public/ vers le serveur : ```bash rsync -avz --delete public/ user@ton-serveur:/var/www/theafriforge/ ``` 3. Config Nginx minimale : ```nginx server { listen 80; server_name theafriforge.org www.theafriforge.org; root /var/www/theafriforge; index index.html; location / { try_files $uri $uri/ =404; } } ``` 4. Activer HTTPS via Certbot (recommande). ### Option 2 - Netlify (ultra rapide) Build command : ```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 ```