feat: 모프로의원 허브 홈에 원장 인터뷰 섹션과 푸터 채널 아이콘을 추가한다
- 홈 'Doctors Explain' 아래 Interview 섹션: 라스트닥터 인터뷰 영상(외부 채널 출처 표시), 밀착인터뷰 글(제목·링크만), 공식 블로그 moprohair, 인스타그램 카드 - VideoLite 캡션에 channel 을 받아 외부 채널 영상의 출처를 병원 핸들 대신 표시한다 - 푸터에 유튜브·인스타그램·네이버 블로그·카카오톡 채널·네이버 플레이스·강남언니·바비톡 아이콘 링크를 넣고, 겹치던 유튜브·강남언니 글자 링크를 뺀다 - 값은 clinic.json(interview, footerChannels), 적용은 patch_site.py 가 빌드마다 다시 한다 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5ff4633926
commit
b7f97ecfa6
9 files changed
+192
-2
No files matched your search
@@ -12,12 +12,15 @@
|
||||
2. 회복 일정 캘린더 파일 정보(PRODID·UID)에 남은 다른 병원 이름을 INFINITH·모프로로 바꾼다
|
||||
3. clinic.json excludeImages 에 해당하는 파일을 public/img 전체에서 지운다(워커는 img/clinic 만 지운다)
|
||||
3b. 영문 화면의 한글 노출을 정리한다(영문 사이트 이름·대표자·빈 값 문구, 팩트 시트 영문 값, 사진 없는 장소 이름 칸)
|
||||
3c. 홈에 'Interview' 섹션(원장 인터뷰 영상·인터뷰 글·공식 블로그·인스타그램)을 넣는다(clinic.json interview)
|
||||
3d. 푸터에 채널 아이콘 줄(유튜브·인스타그램·블로그·카카오톡·플레이스·강남언니·바비톡)을 넣는다(clinic.json footerChannels)
|
||||
4. vercel.json 사이트 주소를 정식 주소로 넣고, 공유 이미지(og.jpg)를 '서포터즈' 없는 상단 문구로 다시 그린다
|
||||
5. src 에 화면용 '서포터즈'가 남아 있으면 실패로 끝낸다
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
@@ -131,6 +134,108 @@ def patch_english():
|
||||
return changed
|
||||
|
||||
|
||||
# 홈 'Interview' 섹션 (haewon 지시 2026-10-19). 원장 인터뷰 영상(외부 채널)과 인터뷰 글·공식 블로그·인스타그램 링크 카드
|
||||
INTERVIEW_ANCHOR = " <section class=\"section light\">\n <div class=\"wrap-wide\">\n <div class=\"sec-head\"><div class=\"eyebrow\">Inside</div>"
|
||||
INTERVIEW_SECTION = """ <section class="section light">
|
||||
<div class="wrap-wide">
|
||||
<div class="sec-head"><div class="eyebrow">Interview</div><h2>Meet The Doctor</h2><p class="sub">문건학 원장 인터뷰와 {clinic} 공식 채널입니다.</p></div>
|
||||
<div class="interview-grid">
|
||||
{interview.video && <div class="interview-video"><VideoLite id={interview.video.id} title={interview.video.title} published={interview.video.published} channel={interview.video.channel} /></div>}
|
||||
{interview.links.map((l) => (
|
||||
<article class="card">
|
||||
<div class="cat">{l.cat}</div>
|
||||
<h3><a href={l.url} rel="noopener" target="_blank">{l.title}</a></h3>
|
||||
<p>{l.desc}</p>
|
||||
<div class="foot">{l.foot}</div>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
.interview-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.25rem; }
|
||||
.interview-video { grid-row: span 3; align-self: start; }
|
||||
.interview-video :global(figure) { margin: 0; }
|
||||
@media (max-width: 860px) { .interview-grid { grid-template-columns: 1fr; } .interview-video { grid-row: auto; } }
|
||||
</style>
|
||||
</section>
|
||||
"""
|
||||
# VideoLite 캡션은 병원 유튜브 핸들을 고정으로 붙인다. 외부 채널 영상은 channel 로 바꿔 쓴다
|
||||
VIDEOLITE_REPLACEMENTS = [
|
||||
("note?: string; compact?: boolean }", "note?: string; compact?: boolean; channel?: string }"),
|
||||
("const { id, title, speaker, published, note, compact = false } = Astro.props;",
|
||||
"const { id, title, speaker, published, note, compact = false, channel } = Astro.props;"),
|
||||
("{handle}{note ?", "{channel ?? handle}{note ?"),
|
||||
]
|
||||
|
||||
|
||||
def patch_home_interview():
|
||||
interview = json.load(open(os.path.join(HERE, "clinic.json"), encoding="utf-8")).get("interview")
|
||||
if not interview:
|
||||
return 0
|
||||
json.dump(interview, open(os.path.join(SITE, "src/data/interview.json"), "w", encoding="utf-8"), ensure_ascii=False, indent=2)
|
||||
vp = os.path.join(SITE, "src/components/VideoLite.astro")
|
||||
text = open(vp, encoding="utf-8").read()
|
||||
for old, new in VIDEOLITE_REPLACEMENTS:
|
||||
text = text.replace(old, new)
|
||||
open(vp, "w", encoding="utf-8").write(text)
|
||||
ip = os.path.join(SITE, "src/pages/index.astro")
|
||||
text = open(ip, encoding="utf-8").read()
|
||||
if "data/interview.json" in text:
|
||||
return 0
|
||||
if INTERVIEW_ANCHOR not in text:
|
||||
sys.exit("index.astro 에서 Inside 섹션을 찾지 못해 Interview 섹션을 넣지 못함")
|
||||
text = text.replace("import Gallery from '../components/Gallery.astro';",
|
||||
"import Gallery from '../components/Gallery.astro';\nimport interview from '../data/interview.json';", 1)
|
||||
text = text.replace(INTERVIEW_ANCHOR, INTERVIEW_SECTION + INTERVIEW_ANCHOR, 1)
|
||||
open(ip, "w", encoding="utf-8").write(text)
|
||||
return 1
|
||||
|
||||
|
||||
# 푸터 채널 아이콘 (haewon 지시 2026-10-19). 유튜브·강남언니 글자 링크는 아이콘 줄로 옮기고 홈페이지 링크만 남긴다
|
||||
FOOTER_LINKS_OLD = "{has(surface('youtube').url) && <> · <a href={surface('youtube').url} rel=\"noopener\">{u.foot_youtube}</a></>}{has(surface('gangnamunni').url) && <> · <a href={surface('gangnamunni').url} rel=\"noopener\">{u.foot_gu}</a></>}</p>"
|
||||
FOOTER_CHANNELS = """</p>
|
||||
<ul class="foot-channels">
|
||||
{footerChannels.map((c) => (
|
||||
<li><a href={c.url} rel="noopener" target="_blank" title={lang === 'en' ? c.labelEn : c.label} style={c.bg ? `background:${c.bg}` : undefined}><img src={`/img/channels/${c.icon}`} alt={lang === 'en' ? c.labelEn : c.label} width="20" height="20" /></a></li>
|
||||
))}
|
||||
</ul>"""
|
||||
FOOTER_CSS = """
|
||||
/* 푸터 채널 아이콘 (patch_site.py 가 넣음) */
|
||||
.site-footer .foot-channels { list-style: none; display: flex; flex-wrap: wrap; gap: 0.55rem; margin: 0.9rem 0 0; padding: 0; }
|
||||
.site-footer .foot-channels a { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; background: #fff; transition: transform .2s, box-shadow .2s; }
|
||||
.site-footer .foot-channels a:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.25); }
|
||||
.site-footer .foot-channels img { width: 20px; height: 20px; display: block; }
|
||||
"""
|
||||
|
||||
|
||||
def patch_footer_channels():
|
||||
channels = json.load(open(os.path.join(HERE, "clinic.json"), encoding="utf-8")).get("footerChannels")
|
||||
if not channels:
|
||||
return 0
|
||||
dst = os.path.join(SITE, "public", "img", "channels")
|
||||
os.makedirs(dst, exist_ok=True)
|
||||
for c in channels:
|
||||
shutil.copyfile(os.path.join(HERE, "channel-icons", c["icon"]), os.path.join(dst, c["icon"]))
|
||||
json.dump(channels, open(os.path.join(SITE, "src/data/footerChannels.json"), "w", encoding="utf-8"), ensure_ascii=False, indent=2)
|
||||
changed = 0
|
||||
cp = os.path.join(SITE, "src/styles/global.css")
|
||||
css = open(cp, encoding="utf-8").read()
|
||||
if ".foot-channels" not in css:
|
||||
open(cp, "w", encoding="utf-8").write(css.rstrip("\n") + "\n" + FOOTER_CSS)
|
||||
changed += 1
|
||||
bp = os.path.join(SITE, "src/layouts/Base.astro")
|
||||
text = open(bp, encoding="utf-8").read()
|
||||
if "data/footerChannels.json" not in text:
|
||||
if FOOTER_LINKS_OLD not in text:
|
||||
sys.exit("Base.astro 에서 푸터 유튜브·강남언니 링크 줄을 찾지 못해 채널 아이콘을 넣지 못함")
|
||||
text = text.replace("import EN from '../data/factSheetEn.json';",
|
||||
"import EN from '../data/factSheetEn.json';\nimport footerChannels from '../data/footerChannels.json';", 1)
|
||||
text = text.replace(FOOTER_LINKS_OLD, FOOTER_CHANNELS, 1)
|
||||
open(bp, "w", encoding="utf-8").write(text)
|
||||
changed += 1
|
||||
return changed
|
||||
|
||||
|
||||
def remove_excluded_images():
|
||||
prefixes = json.load(open(os.path.join(HERE, "clinic.json"), encoding="utf-8")).get("excludeImages", [])
|
||||
removed = []
|
||||
@@ -170,6 +275,8 @@ if __name__ == "__main__":
|
||||
n = patch_copy()
|
||||
n_en = patch_english()
|
||||
print(f"영문 처리 {n_en}곳")
|
||||
print(f"홈 인터뷰 섹션 {patch_home_interview()}곳")
|
||||
print(f"푸터 채널 아이콘 {patch_footer_channels()}곳")
|
||||
removed = remove_excluded_images()
|
||||
set_site_url_and_share_image()
|
||||
left = leftovers()
|
||||
|
||||
Reference in new issue
Block a user