Files
web-at-transit-mock/ui/partials/blog-data/README.md
T
2026-09-23 00:53:04 +07:00

38 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 📁 blog-data — เนื้อหาหน้า "บทความ" (#/blog)
ระบบเดียวกับ `about-data/` — **แต่ละบทความ = textN.json + picN.\*** จับคู่กันตามเลข
(`text1.json`+`pic1.jpg`, `text2.json`+`pic2.jpg`, ...) ระบบไล่เลขไปเรื่อย ๆ จนหาไม่เจอแล้วหยุดเอง
## รูปแบบ textN.json
```json
{
"date": "2026-09-14",
"th": { "title": "หัวข้อบทความ", "tag": "ข่าว", "body": ["ย่อหน้าที่ 1", "ย่อหน้าที่ 2"] },
"en": { "title": "Post title", "tag": "News", "body": ["Paragraph 1", "Paragraph 2"] }
}
```
| ฟิลด์ | จำเป็น? | หมายเหตุ |
|---|---|---|
| `th.title` / `th.body` | ✅ | เนื้อหาไทย (โหมด EN ถ้าไม่เขียน en จะใช้ th แทน) |
| `th.tag` | – | ป้ายมุมการ์ด (เช่น ข่าว / วิธีใช้ / อัปเดต) |
| `en.*` | – | คำแปลอังกฤษ (ไม่ใส่ = ใช้ th) |
| `date` | – | ISO `YYYY-MM-DD` แสดงบนการ์ด (ไม่ใส่ก็ได้) |
## รูป
- วางชื่อ `picN.jpg` (หรือ `.jpeg` / `.png` / `.webp`) — แนะนำ 1200×675 (16:9)
- ไม่มีรูปก็ได้ — การ์ดจะใช้พื้น gradient แทน
## มุมมอง
- หน้า `#/blog` มีปุ่มสลับ **ตาราง (grid)** / **รายการ (list)** — จำค่าที่เลือกไว้
- คลิกการ์ด → เปิดอ่านบทความเต็มที่ `#/blog/N` (มีปุ่มย้อนกลับไปรายการ)
## เพิ่มบทความใหม่
สร้าง `text5.json` + `pic5.jpg` — จบ (ไม่ต้องแก้โค้ด)
> แก้ไฟล์แล้วกด F5 เห็นผลทันที (โหลดแบบ network-first)