--- import '../styles/global.css'; import { existsSync } from 'node:fs'; import { SITE_NAME, SITE_TAGLINE, INDEXABLE, fact, site as S, surface, reservationUrl, editor, has, v } from '../lib'; import { UI, switchHref } from '../lib/i18n'; import EN from '../data/factSheetEn.json'; const ed = editor(); const f = fact as Record; interface Props { title: string; description: string; jsonLd?: Record | Record[]; ogImage?: string; type?: 'website' | 'article'; noindex?: boolean; lang?: 'ko' | 'en'; alternates?: { lang: string; href: string }[]; } // 공유 미리보기 기본 이미지: 워커 build 단계가 만드는 public/og.jpg(1200x630, scripts/make_share_assets.py). 없으면 건물 사진. const shareCard = existsSync('public/og.jpg'); // 공유 카드(og·twitter)는 해외 환자용으로 영어로 낸다(haewon 2026-09-15). site.json shareNameEn(병원 공식 영문 표기)이 있을 때만. // 글(article)은 본문이 한국어라 제목·설명은 글 그대로 두고 사이트 이름만 영어로 쓴다. 영문 페이지는 자기 영어 제목을 쓴다. // ·meta description 은 페이지 언어 그대로 둔다. 검색 결과에 나가는 값이라 공유 카드와 역할이 다르다. const nameEn: string = String((S as Record<string, any>).shareNameEn || '').trim(); const { title, description, jsonLd, ogImage = shareCard ? '/og.jpg' : (S.buildingImage?.src || '/favicon-512.png'), type = 'website', noindex = false, lang = 'ko', alternates = [] } = Astro.props; const site = Astro.site?.toString().replace(/\/$/, '') ?? ''; const cleanPath = Astro.url.pathname.replace(/\/index\.html$/, '/').replace(/\.html$/, ''); const canonical = (new URL(cleanPath, Astro.site).toString().replace(/\/$/, '') || site); const u = UI[lang]; const other = lang === 'ko' ? 'en' : 'ko'; const switchTo = switchHref(Astro.url.pathname, other); const homeHref = lang === 'en' ? '/en' : '/'; const isHome = ['/', '', '/index.html', '/index', '/en', '/en/index.html', '/en/index'].includes(Astro.url.pathname.replace(/\/$/, '') || '/'); // GA4: site.json 의 ga4MeasurementId(G-XXXX) 가 있을 때만 태그를 넣는다. 키 이벤트는 data/ai_channels.json 의 conversion_events 와 같은 이름 // (click_tel · click_reservation · click_clinic_site · click_map). 플래너가 붙이는 click_hotel · click_flight 도 같은 리스너가 받는다. // 플래너 전용 이벤트(plan_procedure_select · plan_result · plan_save)는 components/Planner.astro 가 보낸다. 수술일 원본은 보내지 않는다(haewon 결정 2026-09-12). const GA4: string = /^G-[A-Z0-9]{6,}$/.test(String((S as Record<string, any>).ga4MeasurementId ?? '')) ? String((S as Record<string, any>).ga4MeasurementId) : ''; // 의료광고 고지는 규정 대상이라 임의로 번역하지 않는다(의료법 56조·추천보증 심사지침). // 병원이 영문 문구를 확정해 site.json 의 sponsorNoticeEn / factSheet 의 sideEffectNoticeEn 에 넣기 전까지는 // 한국어 원문을 그대로 싣고 확인 대기임을 밝힌다. i18n.ts 의 영문 foot_sponsor·foot_side 는 이 자리에 쓰지 않는다. const sponsorEn: string = (S as Record<string, any>).sponsorNoticeEn || ''; const sideEffectEn: string = (f as Record<string, any>).sideEffectNoticeEn || ''; const noticePending = lang === 'en' && !sponsorEn; const sponsorText = (lang === 'en' && sponsorEn) ? sponsorEn : UI.ko.foot_sponsor.replace(/\{clinic\}/g, v(f.shortName, '병원')).replace('{editor}', ed.name); const sideEffectText = (lang === 'en' && sideEffectEn) ? sideEffectEn : fact.sideEffectNotice; const siteCard = nameEn ? `${nameEn} Supporters` : SITE_NAME; const cardEn = !!nameEn && type !== 'article' && (lang === 'ko' || isHome); // 영문 페이지 제목·설명에 섞인 한국어 상호는 공유 카드에서만 영문 표기로 바꾼다. const koName = String(f.shortName || '').trim(); const toEn = (t: string) => (nameEn && koName && lang === 'en' ? t.split(koName).join(nameEn) : t); const ogTitle = cardEn ? `${siteCard} · Answers to the questions patients ask first` : toEn(title); const ogDesc = cardEn ? `Recovery planner, getting here, and clinic facts for international patients of ${nameEn}, based on the doctors' own videos and the clinic's public information.` : toEn(description); const ogLocale = cardEn || lang === 'en' ? 'en_US' : 'ko_KR'; const ld = jsonLd ? JSON.stringify({ '@context': 'https://schema.org', ...(Array.isArray(jsonLd) ? { '@graph': jsonLd } : jsonLd) }) : null; --- <!doctype html> <html lang={lang}> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>{title} | {SITE_NAME} {(!INDEXABLE || noindex) && } {ogImage === '/og.jpg' && } {ogImage === '/og.jpg' && } {ogImage === '/og.jpg' && } {alternates.map((a) => )} {ld && } {GA4 &&