feat(supporters): 템플릿화 — 병원 고유값을 데이터로 분리하고 templates/supporters-astro 내보내기

- src/data/site.json 신설(매체 이름·로고·홈 큐레이션), factSheet에 kind·areaLabel·transitShort·transitNote·reservationUrl·doctorsUrl·youtube.title 추가
- lib.ts: PENDING('확인 대기')·v()·has()·surface()·editor() 도입, 스키마는 빈 값을 빼고 생성
- 페이지·컴포넌트 15개에서 뷰성형외과 하드코딩 제거, 빈 데이터 empty-state (글 0편·영상 0건·뉴스 0건·이미지 없음)
- 검증: 28페이지 표시 텍스트·구조 지문 이전 빌드와 동일(홈 title 마침표 1건만 정정), JSON-LD 차이는 빈 sameAs 제거뿐
- scripts/export_template.mjs + scripts/template/data(빈 데이터 세트) → templates/supporters-astro (빈 데이터로 10페이지 0오류 빌드, 게이트 통과)
- 게이트 픽스처를 자체 authors로 분리해 템플릿에서도 테스트 통과, 구조 기준선의 글 상세 페이지는 사전순 첫 글로 동적 선택

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Haewon KamandClaude Fable 5.1 committed 2026-09-07 14:07:14 +09:00
1 parent 49c5e46f23
commit 622441e6aa
100 files changed
+6886 -174

No files matched your search

+45 -27
View File
@@ -1,15 +1,30 @@
// 데이터 진입점. 병원 사실(factSheet) · 사람(authors) · 매체(site) 세 파일만 읽고, 페이지는 이 모듈을 통해서만 값을 쓴다.
// 값이 비어 있으면(null·''·[]) 화면에는 PENDING("확인 대기")을 쓰고 스키마에서는 그 필드를 뺀다. 지어내지 않는다.
import fact from './data/factSheet.json';
import authors from './data/authors.json';
import site from './data/site.json';
export const SITE_NAME = '뷰 서포터즈';
export const SITE_TAGLINE = '뷰성형외과를 알아보는 사람들의 질문에 먼저 답하는 서포터즈 매체 (샘플)';
export const PENDING = '확인 대기';
export const SITE_NAME = site.siteName || `${fact.shortName || '병원'} 서포터즈`;
export const SITE_TAGLINE = site.tagline || `${fact.shortName || '병원'}를 알아보는 사람들의 질문에 먼저 답하는 서포터즈 매체`;
export const INDEXABLE = import.meta.env.PUBLIC_INDEXABLE === 'true';
export const CATEGORY_LABELS: Record<string, string> = {
A: '병원 소개', B: '방문·예약', C: '선택 기준', D: '시술 정보', E: '안전·신뢰', F: '가격·이벤트', G: '후기·평판',
};
export { fact, authors };
export { fact, authors, site };
/** 비어 있으면 PENDING. 화면 표시용. */
export const v = (x: unknown, fallback: string = PENDING): string => (x === null || x === undefined || x === '' ? fallback : String(x));
/** 비어 있지 않은 값만. 스키마·링크용. */
export const has = (x: unknown): boolean => !(x === null || x === undefined || x === '' || (Array.isArray(x) && x.length === 0));
type AnyRec = Record<string, any>;
export const surfaces: AnyRec = (fact as AnyRec).surfaces ?? {};
export const surface = (key: string): AnyRec => surfaces[key] ?? {};
export const reservationUrl: string = (fact as AnyRec).reservationUrl || fact.url || '';
export const editor = (): AnyRec => supporter(site.editorId) ?? { name: PENDING, role: '편집 책임', email: '', bio: '' };
export function supporter(id: string) {
return (authors.supporters as Record<string, any>)[id];
@@ -18,39 +33,42 @@ export function physician(id: string) {
return (authors.physicians as Record<string, any>)[id];
}
export function clinicSchema(site: string) {
const s = fact.surfaces;
return {
const compact = (o: AnyRec): AnyRec => Object.fromEntries(Object.entries(o).filter(([, val]) => has(val)));
export function clinicSchema(siteUrl: string) {
const f = fact as AnyRec;
const sameAs = ['youtube', 'instagram', 'facebook', 'gangnamunni'].map((k) => surface(k).url).concat(f.urlEn).filter(has);
return compact({
'@type': ['MedicalClinic', 'Organization'],
'@id': `${fact.url}/#clinic`,
name: fact.name,
alternateName: fact.shortName,
url: fact.url,
telephone: fact.phone,
faxNumber: fact.fax,
foundingDate: fact.founded,
address: {
'@id': `${f.url}/#clinic`,
name: f.name,
alternateName: f.shortName,
url: f.url,
telephone: f.phone,
faxNumber: f.fax,
foundingDate: f.founded,
address: has(f.address?.street) ? {
'@type': 'PostalAddress',
streetAddress: fact.address.street,
addressLocality: fact.address.locality,
addressRegion: fact.address.region,
streetAddress: f.address.street,
addressLocality: f.address.locality,
addressRegion: f.address.region,
addressCountry: 'KR',
},
openingHoursSpecification: fact.hours.schema.map((h) => ({ '@type': 'OpeningHoursSpecification', ...h })),
} : null,
openingHoursSpecification: (f.hours?.schema ?? []).map((h: AnyRec) => ({ '@type': 'OpeningHoursSpecification', ...h })),
medicalSpecialty: ['PlasticSurgery'],
sameAs: [s.youtube.url, s.instagram.url, s.facebook.url, s.gangnamunni.url, fact.urlEn],
image: `${site}/img/clinic/building-clean.jpg`,
};
sameAs,
image: has(site.buildingImage?.src) ? `${siteUrl}${site.buildingImage.src}` : null,
});
}
export function personSchema(id: string, site: string) {
export function personSchema(id: string, siteUrl: string) {
const a = supporter(id);
return { '@type': 'Person', '@id': `${site}/authors/${id}#person`, name: a.name, jobTitle: a.role, url: `${site}/authors/${id}`, sameAs: a.sameAs };
return compact({ '@type': 'Person', '@id': `${siteUrl}/authors/${id}#person`, name: a.name, jobTitle: a.role, url: `${siteUrl}/authors/${id}`, sameAs: a.sameAs });
}
export function physicianSchema(id: string) {
const p = physician(id);
return {
return compact({
'@type': 'Physician',
'@id': `${p.url}#physician`,
name: p.name,
@@ -59,6 +77,6 @@ export function physicianSchema(id: string) {
sameAs: p.sameAs,
medicalSpecialty: 'PlasticSurgery',
worksFor: { '@id': `${fact.url}/#clinic` },
...(p.image ? { image: p.image } : {}),
};
image: p.image ?? null,
});
}