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 ไฟล์)
This commit is contained in:
Bkk1234 committed 2026-11-10 02:31:10 +07:00
1 parent 1e84023a44
commit 319c271d23
72 files changed
+4731 -765

No files matched your search

+48 -4
View File
@@ -1,13 +1,14 @@
import { CINEMAS } from "@/lib/cinemas";
import type { Locale } from "@/lib/i18n/messages";
import { MESSAGES } from "@/lib/i18n/messages";
import type {
AboutContent,
ArticleContent,
ContentStore,
FooterItem,
LocaleEntry,
TermEntry,
} from "@/lib/content-types";
import type { Locale } from "@/lib/i18n/messages";
import { MESSAGES } from "@/lib/i18n/messages";
import type { Messages } from "@/lib/i18n/messages";
export const DEFAULT_LOCALES: LocaleEntry[] = [
@@ -25,7 +26,9 @@ function flatten(
return;
}
if (value && typeof value === "object") {
for (const [key, child] of Object.entries(value as Record<string, unknown>)) {
for (const [key, child] of Object.entries(
value as Record<string, unknown>,
)) {
flatten(child, prefix ? `${prefix}.${key}` : key, out);
}
}
@@ -43,7 +46,10 @@ export function seedTerms(): TermEntry[] {
return keys.map((key) => ({
key,
values: Object.fromEntries(
Object.entries(perLocale).map(([locale, flat]) => [locale, flat[key] ?? ""]),
Object.entries(perLocale).map(([locale, flat]) => [
locale,
flat[key] ?? "",
]),
),
}));
}
@@ -111,5 +117,43 @@ export function seedContent(): ContentStore {
footer: DEFAULT_FOOTER,
},
about: seedAbout(),
forCinemas: seedForCinemas(),
forFilmLovers: seedForFilmLovers(),
};
}
/** ค่าเริ่มต้นหน้า "สำหรับคนทำโรงหนัง" — ย่อหน้าตั้งต้นมาจาก messages (แก้ต่อได้ในหลังบ้าน) */
export function seedForCinemas(): Record<Locale, ArticleContent> {
return seedArticle(MESSAGES.th.forCinemas, MESSAGES.en.forCinemas);
}
/** ค่าเริ่มต้นหน้า "สำหรับคนรักหนัง" */
export function seedForFilmLovers(): Record<Locale, ArticleContent> {
return seedArticle(MESSAGES.th.forFilmLovers, MESSAGES.en.forFilmLovers);
}
type SeedArticle = {
title: string;
lead: string;
paragraphs: string[];
contactHeading: string;
contactNote: string;
};
/** แปลงข้อความ i18n ของหน้าบทความ → บล็อกเริ่มต้น (ใช้ทั้งหน้าโรงหนังและคนรักหนัง) */
function seedArticle(
th: SeedArticle,
en: SeedArticle,
): Record<Locale, ArticleContent> {
return { th: toArticleContent(th), en: toArticleContent(en) };
}
function toArticleContent(source: SeedArticle): ArticleContent {
return {
title: source.title,
lead: source.lead,
blocks: source.paragraphs.map((text) => ({ type: "paragraph", text })),
contactHeading: source.contactHeading,
contactNote: source.contactNote,
};
}