Files
web-alterflixhub/app/lib/content-types.ts
T
Bkk1234 319c271d23 feat: บทความ 2 หน้า + แชร์/ลิงก์ย่อ + PWA + แอนิเมชัน + SEO/AI + เอกสาร
- บทความจากหลังบ้าน: /for-film-lovers, /for-cinemas (ArticlePage + ArticleEditor แบบบล็อกย่อหน้า/รูป)
- แชร์: ปุ่มบนการ์ดและท้ายหน้ารายละเอียด · ลิงก์ย่อ /c/<slug> (302) · ธีมแก้วตาม DESIGN.md
- PWA: manifest/sw/offline + ถอดการล็อกซูม (WCAG 1.4.4) + touch target ≥44px
- แอนิเมชัน reveal: IntersectionObserver + gate ด้วย html.fx-motion · เคารพ prefers-reduced-motion
- ค้นหา: normalize/ตัดวรรณยุกต์ + AND หลายคำ + จัดอันดับ · รองรับ /?q= จาก SearchAction
- SEO: pageMeta (canonical/OG/Twitter) + JSON-LD (WebSite/Organization/BreadcrumbList/MovieTheater/Article)
- ไม่ฝังโดเมนในโค้ด: origin มาจาก request (x-forwarded-host/proto) ทั้ง canonical, sitemap, robots, ลิงก์แชร์
- กัน AI: robots.txt (Nitro route, บล็อก AI 21 ตัว) + ai.txt + OG image 1200x630
- เอกสาร: README สรุปโปรเจกต์, DESIGN.md (motion/PWA/SEO/ข้อมูล), architecture.html, admin-guide
- tests: 135 ผ่าน (16 ไฟล์)
2026-11-10 02:31:10 +07:00

84 lines
3.0 KiB
TypeScript

/**
* โครงข้อมูลที่แก้ได้จากหน้า admin — เก็บเป็น JSON ใต้ data/content/
* หน้าเว็บอ่านค่าชุดนี้ผ่าน loader ของ root (ฝั่ง server เท่านั้น)
*/
import type { Cinema } from "@/lib/cinemas";
import type { Locale } from "@/lib/i18n/messages";
export type AboutSection = {
heading: string;
body: string;
};
/** เนื้อหาหน้า "เกี่ยวกับเรา" หนึ่งภาษา */
export type AboutContent = {
title: string;
lead: string;
sections: AboutSection[];
contactHeading: string;
contactNote: string;
};
/** ย่อหน้าหนึ่งบล็อกของบทความ (หน้า "สำหรับคนทำโรงหนัง") */
export type ArticleParagraph = {
type: "paragraph";
text: string;
};
/** รูปหนึ่งบล็อกของบทความ — caption ไม่ใส่ได้ */
export type ArticleImage = {
type: "image";
src: string;
alt: string;
caption: string;
};
export type ArticleBlock = ArticleParagraph | ArticleImage;
/** เนื้อหาหน้า "สำหรับคนทำโรงหนัง" หนึ่งภาษา — บทความแบบบล็อก เพิ่มทีละย่อหน้า/รูปได้ */
export type ArticleContent = {
title: string;
lead: string;
blocks: ArticleBlock[];
contactHeading: string;
contactNote: string;
};
export type FooterItem = {
id: string;
/** ชื่อไอคอน Tabler เช่น IconBrandFacebook */
icon_name: string;
label: string;
href: string;
};
export type TermEntry = {
/** dot path เข้าโครงข้อความ เช่น "hero.subtitle" หรือ "categories.อาร์ตเฮาส์" */
key: string;
/** ค่าตามรหัสภาษา เช่น { th: "...", en: "..." } */
values: Record<string, string>;
};
export type LocaleEntry = {
code: string;
label: string;
};
export type SiteContent = {
locales: LocaleEntry[];
terms: TermEntry[];
footer: FooterItem[];
};
export type ContentStore = {
cinemas: Cinema[];
site: SiteContent;
/** เนื้อหาหน้า "เกี่ยวกับเรา" แยกตามภาษา — แก้ได้จากหลังบ้าน */
about: Record<Locale, AboutContent>;
/** เนื้อหาหน้า "สำหรับคนทำโรงหนัง" (บทความแบบบล็อก) แยกตามภาษา — แก้ได้จากหลังบ้าน */
forCinemas: Record<Locale, ArticleContent>;
/** เนื้อหาหน้า "สำหรับคนรักหนัง" (บทความแบบบล็อก) แยกตามภาษา — แก้ได้จากหลังบ้าน */
forFilmLovers: Record<Locale, ArticleContent>;
};