diff --git a/.gitignore b/.gitignore index f2e97e4..82521ef 100755 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ hugo_stats.json go.sum yarn.lock .idea/* +.env \ No newline at end of file diff --git a/README.md b/README.md index f05396a..2278678 100644 --- a/README.md +++ b/README.md @@ -28,3 +28,60 @@ docker rm -f chill-site-container ``` Le site sera accessible sur http://localhost:1313 + +## Utiliser le backend de contact + +Le formulaire de contact du site envoie les données vers un backend Node.js défini dans `contact-backend.js`. + +### 1. Configurer les variables d'environnement + +Créer un fichier `.env` à la racine du projet (ou copier `.env.template`) et renseigner : + +```bash +SMTP_HOST=smtp.example.com +SMTP_PORT=587 +SMTP_SECURE=false +SMTP_USER=utilisateur@example.com +SMTP_FROM=utilisateur@example.com +SMTP_PASS=mot_de_passe +PORT=3001 +``` + +Notes : +- `SMTP_SECURE=true` en général pour le port 465. +- `SMTP_SECURE=false` en général pour les ports 587 et 25. + +### 2. Installer les dépendances Node.js + +Si ce n'est pas déjà fait : + +```bash +npm install +``` + +### 3. Démarrer le backend contact + +```bash +node contact-backend.js +``` + +Le serveur écoute par défaut sur `http://localhost:3001` et expose l'endpoint `POST /contact`. + +### 4. Vérifier l'URL du formulaire + +Dans `content/contact.md`, la valeur `contactForm.action` doit pointer vers le backend : + +```yaml +contactForm: + action: "http://localhost:3001/contact" +``` + +### 5. Lancer le site Hugo + +Dans un autre terminal : + +```bash +npm run start +``` + +Le formulaire sera alors fonctionnel en local, à condition que le backend tourne en même temps. diff --git a/themes/chill-theme/layouts/shortcodes/contact-form.html b/themes/chill-theme/layouts/shortcodes/contact-form.html index b14e6ed..8fd6914 100644 --- a/themes/chill-theme/layouts/shortcodes/contact-form.html +++ b/themes/chill-theme/layouts/shortcodes/contact-form.html @@ -3,7 +3,7 @@