diff --git a/README.md b/README.md index 9d41c8f..13b34ee 100644 --- a/README.md +++ b/README.md @@ -1,187 +1,137 @@ -# 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 d’adhé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) +- L’option `-D` affiche aussi les contenus en brouillon. -Genere les fichiers statiques optimises dans public/ : +## 🏗️ Structure du projet -```bash -hugo --config ./hugo.toml --environment production --minify -``` +- `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 -Le dossier de sortie a deployer est : -- public/ +## 🛠️ Commandes utiles -## 5) Tester la build de production en local +- Build de production : + ```bash + hugo --config ./hugo.toml --environment production --minify + ``` +- Nettoyage du cache Hugo : + ```bash + rm -rf resources/_gen + ``` +- Forcer un autre port local : + ```bash + hugo server --config ./hugo.toml -D --port 1314 + ``` -Option A (Python, simple) : +## 🐞 Dépannage -```bash -python3 -m http.server 8080 --directory 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. -Option B (Node) : +## 🚢 Déploiement -```bash -npx serve public -``` +### Option 1 : VPS + Nginx -Puis ouvre : -- http://localhost:8080/ (Python) -- URL affichee par serve (Node) +1. Générer la build : + ```bash + hugo --config ./hugo.toml --environment production --minify + ``` +2. Copier le dossier `public/` sur le serveur : + ```bash + rsync -avz --delete public/ user@serveur:/var/www/theafriforge/ + ``` +3. Configurer Nginx (voir exemple ci-dessous) : + ```nginx + server { + listen 80; + server_name theafriforge.org www.theafriforge.org; -## 6) Deploiement en production + root /var/www/theafriforge; + index index.html; -### Option 1 - VPS + Nginx (recommande pour controle complet) + location / { + try_files $uri $uri/ =404; + } + } + ``` +4. Activer HTTPS (Certbot recommandé). -1. Build local : +### Option 2 : Netlify / Cloudflare Pages / Vercel -```bash -hugo --config ./hugo.toml --environment production --minify -``` +- Build command : `hugo --config ./hugo.toml --environment production --minify` +- Output/Publish directory : `public` +- Sélectionner Hugo Extended si nécessaire. -2. Copier public/ vers le serveur : +## 📄 Licence -```bash -rsync -avz --delete public/ user@ton-serveur:/var/www/theafriforge/ -``` - -3. Config Nginx minimale : - -```nginx -server { - listen 80; +Ce projet est open source, voir le dépôt pour plus d’informations. 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 -```