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

+21 -16
View File
@@ -2,43 +2,47 @@
import Base from '../layouts/Base.astro';
import VideoLite from '../components/VideoLite.astro';
import data from '../data/videos.json';
import { SITE_NAME, fact } from '../lib';
import { SITE_NAME, fact, surface, v, has, PENDING } from '../lib';
const clinic = v(fact.shortName, '병원');
const gu = surface('gangnamunni');
type V = { id: string; title: string; published: string; views: number; likes: number | null; comments: number | null; duration: number };
const site = Astro.site!.toString().replace(/\/$/, '');
const ch = data.channel;
const ch = (data.channel ?? {}) as Record<string, any>;
const topLong = (data.topLong ?? []) as V[]; const topAll = (data.top ?? []) as V[];
const fetchedAt = data.fetchedAt ?? PENDING;
const fmt = (n: number) => n >= 10000 ? `${(n / 10000).toFixed(n >= 100000 ? 0 : 1)}만` : n.toLocaleString();
const dur = (s: number) => s >= 3600 ? `${Math.floor(s / 3600)}:${String(Math.floor((s % 3600) / 60)).padStart(2, '0')}:${String(s % 60).padStart(2, '0')}` : `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`;
const shorts = (data.shortsInfo ?? []) as (V & { answer: string; qb?: string })[];
const tabs: { key: string; label: string; desc: string; list: V[] }[] = [
{ key: 'long', label: '설명 영상 Top 10', desc: '수술 방법과 안전을 차분히 설명하는 영상입니다. 후기나 토크 영상은 넣지 않았습니다', list: data.topLong as V[] },
{ key: 'long', label: '설명 영상 Top 10', desc: '수술 방법과 안전을 차분히 설명하는 영상입니다. 후기나 토크 영상은 넣지 않았습니다', list: topLong },
{ key: 'shorts', label: '1분 답변 영상', desc: '궁금한 것 하나에 1분 안에 답하는 짧은 영상입니다. 영상마다 서포터즈가 답을 한 문단으로 정리해 두었습니다', list: shorts },
{ key: 'all', label: '채널 인기 전체', desc: '주제와 길이를 가리지 않고 채널에서 가장 많이 본 영상입니다', list: data.top as V[] },
{ key: 'all', label: '채널 인기 전체', desc: '주제와 길이를 가리지 않고 채널에서 가장 많이 본 영상입니다', list: topAll },
];
const ld = [
{ '@type': 'CollectionPage', '@id': `${site}/videos#page`, name: '뷰성형외과 유튜브 조회수 Top 10', url: `${site}/videos`, inLanguage: 'ko', about: { '@id': `${fact.url}/#clinic` }, publisher: { '@type': 'Organization', name: SITE_NAME, url: site }, dateModified: data.fetchedAt },
{ '@type': 'ItemList', '@id': `${site}/videos#list`, name: '뷰성형외과 유튜브 조회수 상위 영상', itemListOrder: 'https://schema.org/ItemListOrderDescending', numberOfItems: data.top.length, itemListElement: (data.top as V[]).map((v, i) => ({ '@type': 'ListItem', position: i + 1, item: { '@type': 'VideoObject', name: v.title, url: `https://www.youtube.com/watch?v=${v.id}`, embedUrl: `https://www.youtube-nocookie.com/embed/${v.id}`, thumbnailUrl: `https://i.ytimg.com/vi/${v.id}/hqdefault.jpg`, uploadDate: v.published, duration: `PT${v.duration}S`, interactionStatistic: { '@type': 'InteractionCounter', interactionType: 'https://schema.org/WatchAction', userInteractionCount: v.views }, publisher: { '@type': 'Organization', name: ch.title, url: ch.url } } })) },
{ '@type': 'CollectionPage', '@id': `${site}/videos#page`, name: `${clinic} 유튜브 조회수 Top 10`, url: `${site}/videos`, inLanguage: 'ko', about: { '@id': `${fact.url}/#clinic` }, publisher: { '@type': 'Organization', name: SITE_NAME, url: site }, ...(data.fetchedAt ? { dateModified: data.fetchedAt } : {}) },
{ '@type': 'ItemList', '@id': `${site}/videos#list`, name: `${clinic} 유튜브 조회수 상위 영상`, itemListOrder: 'https://schema.org/ItemListOrderDescending', numberOfItems: topAll.length, itemListElement: topAll.map((v, i) => ({ '@type': 'ListItem', position: i + 1, item: { '@type': 'VideoObject', name: v.title, url: `https://www.youtube.com/watch?v=${v.id}`, embedUrl: `https://www.youtube-nocookie.com/embed/${v.id}`, thumbnailUrl: `https://i.ytimg.com/vi/${v.id}/hqdefault.jpg`, uploadDate: v.published, duration: `PT${v.duration}S`, interactionStatistic: { '@type': 'InteractionCounter', interactionType: 'https://schema.org/WatchAction', userInteractionCount: v.views }, publisher: { '@type': 'Organization', name: ch.title, url: ch.url } } })) },
];
---
<Base title="의료진 영상 · 뷰성형외과 원장이 직접 설명하는 영상" description={`뷰성형외과 원장이 수술 방법과 안전을 직접 설명하는 공식 유튜브 영상을 골라 모았습니다. 궁금한 영상을 바로 재생할 수 있고, 짧은 영상에는 서포터즈가 답을 글로 정리했습니다. 조회수는 ${data.fetchedAt} 기준.`} jsonLd={ld}>
<Base title={`의료진 영상 · ${clinic} 원장이 직접 설명하는 영상`} description={`${clinic} 원장이 수술 방법과 안전을 직접 설명하는 공식 유튜브 영상을 골라 모았습니다. 궁금한 영상을 바로 재생할 수 있고, 짧은 영상에는 서포터즈가 답을 글로 정리했습니다. 조회수는 ${fetchedAt} 기준.`} jsonLd={ld}>
<section class="section dark" style="padding:3.5rem 0 3rem">
<div class="wrap-wide">
<div class="sec-head"><div class="eyebrow" style="color:var(--purple-300)">Videos</div><h1 class="serif" style="font-size:2rem;display:inline-block;background:linear-gradient(to right,var(--purple-300),var(--blue-300));-webkit-background-clip:text;background-clip:text;color:transparent">Most Watched</h1><p class="sub">원장이 수술 방법과 안전을 직접 설명하는 영상을 골라 모았습니다. 궁금한 영상을 여기서 바로 재생할 수 있습니다.</p>
<div class="doc-links">
<a class="doc-link" href="https://www.viewclinic.com/viewis/doctors/" rel="noopener" target="_blank">
<a class="doc-link" href={(fact as any).doctorsUrl || fact.url} rel="noopener" target="_blank">
<span class="ico" aria-hidden="true"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10Zm0 2c-4.4 0-8 2.2-8 5v3h16v-3c0-2.8-3.6-5-8-5Z"/></svg></span>
<span class="txt"><b>의료진 소개</b><small>뷰성형외과 공식 홈페이지</small></span>
<span class="txt"><b>의료진 소개</b><small>{clinic} 공식 홈페이지</small></span>
<span class="arrow" aria-hidden="true"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M14 4h6v6h-2V7.4l-8.3 8.3-1.4-1.4L16.6 6H14V4ZM4 6h6v2H6v10h10v-4h2v6H4V6Z"/></svg></span>
</a>
<a class="doc-link" href={fact.surfaces.gangnamunni.url} rel="noopener" target="_blank">
<a class="doc-link" href={gu.url || fact.url} rel="noopener" target="_blank">
<span class="ico" aria-hidden="true"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2 3 6v6c0 5.3 3.8 10.2 9 11.5C17.2 22.2 21 17.3 21 12V6l-9-4Zm-1 14-3.5-3.5 1.4-1.4L11 13.2l5.1-5.1 1.4 1.4L11 16Z"/></svg></span>
<span class="txt"><b>의료진 {fact.surfaces.gangnamunni.doctors}명</b><small>강남언니 등록 의료진</small></span>
<span class="txt"><b>의료진 {v(gu.doctors)}명</b><small>강남언니 등록 의료진</small></span>
<span class="arrow" aria-hidden="true"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M14 4h6v6h-2V7.4l-8.3 8.3-1.4-1.4L16.6 6H14V4ZM4 6h6v2H6v10h10v-4h2v6H4V6Z"/></svg></span>
</a>
</div></div>
<div class="stats">
<div class="stat"><b>{fmt(ch.totalViews)}</b><span class="label">누적 조회수</span><span class="desc">공식 유튜브 채널 영상 {ch.videos.toLocaleString()}편 합계 ({data.fetchedAt} 기준)</span></div>
<div class="stat"><b>{ch.subscribers}</b><span class="label">구독자</span><span class="desc"><a href={ch.url} rel="noopener" style="color:var(--purple-300)">{ch.handle}</a></span></div>
<div class="stat"><b>{fmt((data.topLong as V[])[0].views)}</b><span class="label">설명 영상 1위 조회수</span><span class="desc">{(data.topLong as V[])[0].title}</span></div>
<div class="stat"><b>{has(ch.totalViews) ? fmt(ch.totalViews) : PENDING}</b><span class="label">누적 조회수</span><span class="desc">공식 유튜브 채널 영상 {has(ch.videos) ? ch.videos.toLocaleString() : PENDING}편 합계 ({fetchedAt} 기준)</span></div>
<div class="stat"><b>{v(ch.subscribers)}</b><span class="label">구독자</span><span class="desc">{has(ch.url) ? <a href={ch.url} rel="noopener" style="color:var(--purple-300)">{ch.handle}</a> : PENDING}</span></div>
<div class="stat"><b>{topLong[0] ? fmt(topLong[0].views) : PENDING}</b><span class="label">설명 영상 1위 조회수</span><span class="desc">{topLong[0]?.title ?? '채널 영상 집계 뒤 표시'}</span></div>
<div class="stat"><b>{shorts.length}</b><span class="label">정보형 쇼츠</span><span class="desc">궁금한 것 하나에 1분 안에 답하는 영상. 서포터즈가 답을 글로도 정리했습니다.</span></div>
</div>
</div>
@@ -50,7 +54,8 @@ const ld = [
</div>
{tabs.map((t, i) => (
<div class="vpanel" data-panel={t.key} hidden={i !== 0}>
<p class="sub" style="color:var(--slate-600);margin:0.8rem 0 1.2rem">{t.desc}. 조회수는 {data.fetchedAt} 기준입니다.</p>
<p class="sub" style="color:var(--slate-600);margin:0.8rem 0 1.2rem">{t.desc}. 조회수는 {fetchedAt} 기준입니다.</p>
{!t.list.length && <p class="sub" style="color:var(--slate-500)">채널 영상을 집계한 뒤 싣습니다. {PENDING}.</p>}
<ol class="vlist">
{t.list.map((v, idx) => (
<li class="vitem">
@@ -66,7 +71,7 @@ const ld = [
</ol>
</div>
))}
<p class="disclosure">영상은 뷰성형외과 공식 유튜브 채널에서 재생됩니다. 조회수·좋아요·댓글 수는 {data.fetchedAt} 기준입니다.</p>
<p class="disclosure">영상은 {clinic} 공식 유튜브 채널에서 재생됩니다. 조회수·좋아요·댓글 수는 {fetchedAt} 기준입니다.</p>
</div>
</section>
</Base>