Add env-configurable GA/form/map; remove & artifacts; verify clone completeness

- Remove 4 stray '&' files (crawl artifact) that duplicated footer/about-us/contactus/root
- Replace hardcoded GA id, form email, map src with placeholders (GA_ID, FORM_EMAIL, GMAP_EMBED)
- Add entrypoint.sh: envsubst injects env vars into HTML at container startup
- Add .env.example + .dockerignore/.gitignore guarding .env secrets
- Google Map type A (free embed, no API key) configurable via GMAP_LAT/LNG
- Verify: all 39 pages, images (38/home), content blocks (296) match original; 0 missing assets

Full clone comparison against www.mitsuthailand.com confirms sections complete.
This commit is contained in:
2026-08-06 14:27:32 +07:00
parent e04ea1dd27
commit eea7c4780e
47 changed files with 2276 additions and 8026 deletions

View File

@@ -40,17 +40,30 @@ docker run -d -p 8080:80 mitsu-chaiyaporn
---
## ✉️ ฟอร์มส่งอีเมล
## ✉️ ฟอร์มส่งอีเมล + ตัวแปร Environment (.env)
เดิมฟอร์มขอใบเสนอราคา (RFQ) / ติดต่อ ส่งข้อมูลไปยังหลังบ้าน Drupal ที่จะตายพร้อม host เก่า
จึงแปลงให้ส่งเป็น **อีเมล** ผ่าน [FormSubmit.co](https://formsubmit.co) (ไม่ต้องมี backend):
เดิมฟอร์มขอใบเสนอราคา (RFQ) / ติดต่อ ส่งข้อมูลไปยังหลังบ้าน Drupal ที่จะตาย จึงแปลงให้
ส่งเป็น **อีเมล** ผ่าน [FormSubmit.co](https://formsubmit.co) — และค่าต่างๆ (GA, อีเมล,
Google Map) กำหนดได้ผ่าน **environment variables** แล้ว (inject ที่ container startup โดย `entrypoint.sh`)
- ตัวรับเมล: ตั้งค่าได้ใน `rewrite.py``FORM_RECIPIENT`
```python
FORM_RECIPIENT = "mail@mitsuchaiyaporn.com" # ← เปลี่ยนเป็นอีเมลที่ต้องการรับ
```
- หลังแก้ ต้อง**ยืนยันอีเมล**ครั้งแรกที่ formsubmit.co (กดลิงก์ที่ส่งไป) ฟอร์มถึงใช้งานได้
- เปลี่ยนแล้ว re-deploy (หรือรัน `rewrite` ใหม่) ก็พอ
| ตัวแปร | ค่า default | ความหมาย |
|--------|------------|----------|
| `GA_ID` | *(ว่าง=ปิด GA)* | Google Analytics / GTM Measurement ID (เช่น `G-XXXX`) |
| `FORM_EMAIL` | `mail@mitsuchaiyaporn.com` | อีเมลที่รับฟอร์ม RFQ/ติดต่อ |
| `GMAP_LAT` / `GMAP_LNG` | `13.55722…` / `100.289…` | พิกัดแผนที่ (แบบฟรี ไม่ต้อง API key) |
| `GMAP_EMBED` | *(คำนวณจาก lat/lng)* | URL embed Google Map เต็ม (override ได้) |
**วิธีใช้บน EasyPanel:** ไปที่หน้า Service → Environment/Env → เพิ่มตัวแปรข้างบน
(หรือ copy `.env.example` ตั้งค่าแล้ว inject) แล้ว Redeploy
**วิธีใช้ local/docker:**
```bash
cp .env.example .env # แก้ค่าตามต้องการ
docker build -t mitsu-chaiyaporn .
docker run --env-file .env -p 8080:80 mitsu-chaiyaporn
```
> ⚠️ หลังตั้ง `FORM_EMAIL` ต้อง**ยืนยันอีเมลครั้งแรก**ที่ formsubmit.co (กดลิงก์ที่ส่งไป) ฟอร์มถึงส่งได้จริง
---