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

@@ -0,0 +1,6 @@
---
import { fact, SITE_NAME, v } from '../lib';
---
<p class="disclosure">
{SITE_NAME} 활동은 {v(fact.shortName, '병원')}의 지원을 받습니다. 이 글에는 다른 환자의 치료 경험담과 전후 사진을 싣지 않습니다. {fact.sideEffectNotice}
</p>
@@ -0,0 +1,19 @@
---
import { fact, v, has } from '../lib';
const f = fact as Record<string, any>;
const rows = f.hours?.rows ?? [];
interface Props { compact?: boolean }
const { compact = false } = Astro.props;
---
<aside class="fact-block" aria-label="병원 기본 정보">
<h2>{v(f.shortName, '병원')} 기본 정보</h2>
<dl>
<dt>정식 명칭</dt><dd>{v(f.name)}</dd>
<dt>주소</dt><dd>{v(f.address?.full)}</dd>
<dt>전화</dt><dd>{has(f.phone) ? <a href={`tel:${f.phone.replace(/-/g, '')}`}>{f.phone}</a> : v(f.phone)}</dd>
<dt>진료시간</dt><dd>{rows.length ? rows.map((r: any) => r.open ? `${r.days} ${r.open}~${r.close}` : `${r.days} ${r.note}`).join(' · ') : v(null)}</dd>
<dt>가는 길</dt><dd>{v(f.transit)}</dd>
{!compact && <><dt>개원</dt><dd>{has(f.founded) ? `${f.founded}년` : v(null)}</dd><dt>규모</dt><dd>{v(f.building?.summary)}</dd></>}
</dl>
<p style="margin:0.8rem 0 0;font-size:0.8rem;color:var(--slate-500)">진료시간 출처: {has(f.hours?.source) ? <a href={f.hours.source} rel="noopener">{f.hours.sourceLabel}</a> : v(null)}. 주소·전화는 {has(f.address?.source) ? <a href={f.address.source} rel="noopener">공식 홈페이지 표기</a> : '공식 홈페이지 표기'}를 따릅니다. 이 정보는 {v(f.checkedAt, '확인일 미정')}에 확인했고 다음 확인 예정일은 {v(f.nextCheck, '미정')}입니다.</p>
</aside>
@@ -0,0 +1,15 @@
---
interface Props { items: { q: string; a: string }[] }
const { items } = Astro.props;
---
{items.length > 0 && (
<section class="faq" aria-label="자주 묻는 질문">
<h2>자주 묻는 질문</h2>
{items.map((f) => (
<details>
<summary>{f.q}</summary>
<p>{f.a}</p>
</details>
))}
</section>
)}
@@ -0,0 +1,14 @@
---
interface Props { items: { src: string; alt: string; caption: string }[]; cols?: 2 | 3 }
const { items, cols = 2 } = Astro.props;
---
{items.length > 0 && (
<div class={`gallery cols-${cols}`}>
{items.map((g) => (
<figure class="figure">
<img src={g.src} alt={g.alt} loading="lazy" />
<figcaption>{g.caption}</figcaption>
</figure>
))}
</div>
)}
@@ -0,0 +1,16 @@
---
// 갱신 기록. 무엇을 언제 바꿨는지 독자가 볼 수 있게 한다.
interface Props { items: { date: string; note: string }[] }
const { items } = Astro.props;
---
{items.length > 0 && (
<section class="history" aria-label="갱신 기록">
<h2>갱신 기록</h2>
<ul>{[...items].reverse().map((h) => <li><time datetime={h.date}>{h.date}</time> {h.note}</li>)}</ul>
</section>
)}
<style>
.history ul { list-style: none; padding: 0; margin: 0; font-size: 0.92rem; }
.history li { padding: 0.35rem 0; border-bottom: 1px solid var(--slate-100); }
.history time { display: inline-block; min-width: 6.5em; color: var(--slate-500); font-variant-numeric: tabular-nums; }
</style>
@@ -0,0 +1,18 @@
---
import { CATEGORY_LABELS, supporter, site as S, fact } from '../lib';
interface Props { post: any }
const { post } = Astro.props;
const d = post.data;
const v0 = d.videos?.[0] ?? d.video;
const thumb = d.thumbnail ?? d.hero?.src ?? (v0 ? `https://i.ytimg.com/vi/${v0.id}/hqdefault.jpg` : S.buildingImage?.src ?? '/favicon.svg');
const thumbAlt = d.hero?.alt ?? (v0 ? `유튜브 영상 썸네일: ${v0.title}` : S.buildingImage?.alt ?? `${fact.shortName} 건물 외관`);
---
<article class="card has-thumb">
<a class="thumb" href={`/posts/${post.id}`}><img src={thumb} alt={thumbAlt} loading="lazy" /></a>
<div class="body">
<div class="cat">{d.category} · {CATEGORY_LABELS[d.category]}</div>
<h3><a href={`/posts/${post.id}`}>{d.title}</a></h3>
<p>{d.summary[0]}</p>
<div class="foot">{supporter(d.author).name} · {d.dateModified} 갱신</div>
</div>
</article>
@@ -0,0 +1,11 @@
---
import VideoLite from './VideoLite.astro';
interface Props { items: { id: string; title: string; speaker?: string; published?: string; note?: string }[]; title?: string }
const { items, title = '관련 영상' } = Astro.props;
---
{items.length > 0 && (
<section>
<h2>{title}</h2>
<div class="video-grid">{items.map((v) => <VideoLite {...v} compact />)}</div>
</section>
)}
@@ -0,0 +1,19 @@
---
import { supporter, physician } from '../lib';
interface Props { author: string; reviewer?: string; status: 'reviewed' | 'pending'; dateModified: string }
const { author, reviewer, status, dateModified } = Astro.props;
const a = supporter(author);
const p = reviewer ? physician(reviewer) : null;
---
<section class="review-box" aria-label="작성·감수 정보">
{p?.image ? <img src={p.image} alt={`${p.name} ${p.title}`} width="56" height="56" /> : <div class="avatar">{a.name.slice(0, 1)}</div>}
<div>
<div><strong>작성</strong> <a href={`/authors/${author}`}>{a.name}</a> · {a.role} {a.email ? <> · 정정 요청 <a href={`mailto:${a.email}`}>{a.email}</a></> : <> · 정정 요청은 <a href="/corrections">정정 기록</a> 페이지 안내를 따릅니다</>}</div>
{p && status === 'reviewed' ? (
<div><strong>의학 검토</strong> {p.name} {p.title} <span class="badge reviewed">검토 완료 {dateModified}</span></div>
) : (
<div><strong>의학 검토</strong> <span class="badge pending">검토 대기</span> <span style="color:var(--slate-500)">병원이 담당 원장과 검토일을 확정하면 표시합니다.</span></div>
)}
<div style="color:var(--slate-500);margin-top:0.3rem">서포터즈는 의학적 판단을 하지 않습니다. 시술 여부와 방법은 반드시 전문의 상담으로 결정하세요.</div>
</div>
</section>
@@ -0,0 +1,16 @@
---
// 참고 자료. type으로 근거의 성격을 구분한다. 규제·연구 자료가 있는 주장은 영상 재진술이 아니라 원문까지 닿게 한다.
interface Props { items: { label: string; url: string; accessed: string; type?: string }[] }
const { items } = Astro.props;
const TYPE: Record<string, string> = { clinic: '병원 제공', doctor: '원장 설명 (영상)', product: '제품 정보 (제조사)', regulation: '규제·연구 자료', platform: '플랫폼 집계', secondary: '2차 자료' };
---
{items.length > 0 && (
<section class="sources">
<h2>참고한 자료</h2>
<ul>{items.map((s) => <li>{s.type && <span class="stype">{TYPE[s.type] ?? s.type}</span>} <a href={s.url} rel="noopener">{s.label}</a> <span style="color:var(--slate-500)">({s.accessed} 확인)</span></li>)}</ul>
<p style="font-size:0.83rem;color:var(--slate-500);margin:0.6rem 0 0">원장 설명은 영상 시점의 임상 의견이고, 제품 정보는 제조사 자료이며, 규제·연구 자료만 독립 검증에 해당합니다.</p>
</section>
)}
<style>
.stype { display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em; color: var(--st-info-text); background: var(--st-info-bg); border: 1px solid var(--st-info-border); border-radius: 999px; padding: 0.05rem 0.55rem; margin-right: 0.35rem; vertical-align: 1px; }
</style>
@@ -0,0 +1,9 @@
---
// 직접 답변 블록. 기업은행 블로그의 "세 줄 요약"에서 가져온 구조. 답변엔진이 잘라 쓰는 단락이다.
interface Props { items: string[] }
const { items } = Astro.props;
---
<section class="summary" aria-label="세 줄 요약">
<h2>세 줄 요약</h2>
<ol>{items.map((t) => <li>{t}</li>)}</ol>
</section>
@@ -0,0 +1,9 @@
---
interface Props { id: string; title: string; channel: string; speaker?: string; published?: string }
const { id, title, channel, speaker, published } = Astro.props;
---
<h2>원본 영상</h2>
<div class="video">
<iframe loading="lazy" src={`https://www.youtube-nocookie.com/embed/${id}`} title={title} allow="accelerometer; encrypted-media; picture-in-picture" allowfullscreen></iframe>
</div>
<p class="video-note">{channel} · {title}{speaker ? ` · 출연 ${speaker}` : ''}{published ? ` · ${published} 게시` : ''}. 이 글은 영상 발화를 서포터즈가 글로 재구성한 것이며, 영상 설명란 텍스트를 복사하지 않았습니다.</p>
@@ -0,0 +1,27 @@
---
// 유튜브 라이트 임베드: 썸네일(i.ytimg.com) + 재생 버튼. 클릭 시 iframe으로 교체. 헤드리스·저속 환경에서도 시각적으로 보인다.
import { surface } from '../lib';
interface Props { id: string; title: string; speaker?: string; published?: string; note?: string; compact?: boolean }
const handle = surface('youtube').handle ? `유튜브 ${surface('youtube').handle}` : '유튜브';
const { id, title, speaker, published, note, compact = false } = Astro.props;
---
<figure class={`yt ${compact ? 'compact' : ''}`}>
<button class="yt-btn" type="button" data-yt={id} aria-label={`영상 재생: ${title}`}>
<img src={`https://i.ytimg.com/vi/${id}/hqdefault.jpg`} alt={`유튜브 영상 썸네일: ${title}`} loading="lazy" width="480" height="360" />
<span class="play" aria-hidden="true"><svg width="26" height="26" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg></span>
</button>
<figcaption>
<strong>{title}</strong>
<span>{speaker ? `${speaker} · ` : ''}{published ? `${published} 게시 · ` : ''}{handle}{note ? ` · ${note}` : ''}</span>
</figcaption>
</figure>
<script>
document.querySelectorAll<HTMLButtonElement>('.yt-btn').forEach((btn) => {
btn.addEventListener('click', () => {
const id = btn.dataset.yt!;
const wrap = document.createElement('div'); wrap.className = 'yt-frame';
wrap.innerHTML = `<iframe src="https://www.youtube-nocookie.com/embed/${id}?autoplay=1&rel=0" title="YouTube video" allow="accelerometer; autoplay; encrypted-media; picture-in-picture" allowfullscreen></iframe>`;
btn.replaceWith(wrap);
}, { once: true });
});
</script>