Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb14e530a1 | ||
|
|
5ca51d10b6 | ||
|
|
ba206322b7 | ||
|
|
998d609fd8 | ||
|
|
21340e767e | ||
|
|
29f798f3c7 | ||
|
|
b7f97ecfa6 | ||
|
|
6d2cefac91 | ||
|
|
1125f42324 |
No files matched your search
@@ -20,7 +20,10 @@
|
|||||||
const ALLOWED_ORIGINS = [
|
const ALLOWED_ORIGINS = [
|
||||||
'https://webforai.kr',
|
'https://webforai.kr',
|
||||||
'https://www.webforai.kr',
|
'https://www.webforai.kr',
|
||||||
|
'https://infinith.webforai.kr',
|
||||||
'https://aio2o.webforai.kr',
|
'https://aio2o.webforai.kr',
|
||||||
|
'https://www.o2osolution.ai',
|
||||||
|
'https://o2osolution.ai',
|
||||||
];
|
];
|
||||||
|
|
||||||
export default async function handler(req, res) {
|
export default async function handler(req, res) {
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
"clean": "rm -rf dist",
|
"clean": "rm -rf dist",
|
||||||
"lint": "tsc --noEmit",
|
"lint": "tsc --noEmit",
|
||||||
"db:sync": "tsx scripts/sync-db-local.ts",
|
"db:sync": "tsx scripts/sync-db-local.ts",
|
||||||
"sync-registry": "tsx scripts/import-registry.ts"
|
"sync-registry": "tsx scripts/import-registry.ts",
|
||||||
|
"test": "node --experimental-strip-types --no-warnings --test tests/*.test.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@google/genai": "^1.29.0",
|
"@google/genai": "^1.29.0",
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
/**
|
||||||
|
* 문의 유입 기록(UTM).
|
||||||
|
*
|
||||||
|
* webforai.kr·company·region(webforai-landing 저장소 site/assets/attr.js)과 같은 규칙·같은 쿠키(wfa_attr, Domain=.webforai.kr)를 쓴다.
|
||||||
|
* 그래서 네이버 블로그 → infinith.webforai.kr → webforai.kr 처럼 서브도메인을 옮겨 다녀도 같은 기록이 남는다.
|
||||||
|
*
|
||||||
|
* 규칙: 마지막으로 들어온 '직접 방문이 아닌' 경로를 30일 기억(last non-direct touch).
|
||||||
|
* - 주소에 utm_* 가 있으면 덮어쓴다
|
||||||
|
* - utm 없이 외부 사이트(또는 광고 클릭 ID)로 왔으면, 살아 있는 utm 기록이 없을 때만 ref 로 남긴다
|
||||||
|
* - 직접 방문·같은 사이트 안 이동은 기록을 바꾸지 않는다
|
||||||
|
* 문의 함수로 보내는 source 뒤에 붙는다. 예: footer | utm:naver_blog/organic/2611_webforai_hospital | land:infinith.webforai.kr/
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const ATTR_KEY = 'wfa_attr';
|
||||||
|
export const ATTR_TTL_MS = 30 * 24 * 60 * 60 * 1000;
|
||||||
|
const UTM_KEYS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'] as const;
|
||||||
|
const CLICK_IDS = ['fbclid', 'gclid', 'NaPm'] as const;
|
||||||
|
|
||||||
|
export interface Attribution {
|
||||||
|
utm?: Partial<Record<(typeof UTM_KEYS)[number], string>>;
|
||||||
|
click?: string;
|
||||||
|
ref?: string;
|
||||||
|
land: string;
|
||||||
|
at: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const clean = (s: string) => s.replace(/[|\s]+/g, ' ').trim().slice(0, 60);
|
||||||
|
const baseDomain = (h: string) => h.split('.').slice(-2).join('.');
|
||||||
|
|
||||||
|
export function nextAttribution(
|
||||||
|
prev: Attribution | null,
|
||||||
|
search: string,
|
||||||
|
referrer: string,
|
||||||
|
host: string,
|
||||||
|
land: string,
|
||||||
|
now: number,
|
||||||
|
): Attribution | null {
|
||||||
|
const q = new URLSearchParams(search);
|
||||||
|
const utm: NonNullable<Attribution['utm']> = {};
|
||||||
|
for (const k of UTM_KEYS) {
|
||||||
|
const v = q.get(k);
|
||||||
|
if (v) utm[k] = clean(v);
|
||||||
|
}
|
||||||
|
const click = CLICK_IDS.find((k) => q.has(k));
|
||||||
|
const alive = prev && now - prev.at < ATTR_TTL_MS ? prev : null;
|
||||||
|
if (Object.keys(utm).length) return { utm, click, land, at: now };
|
||||||
|
|
||||||
|
let refHost = '';
|
||||||
|
try {
|
||||||
|
refHost = referrer ? new URL(referrer).hostname : '';
|
||||||
|
} catch {
|
||||||
|
refHost = '';
|
||||||
|
}
|
||||||
|
const external = !!refHost && refHost !== host && baseDomain(refHost) !== baseDomain(host);
|
||||||
|
if (alive?.utm) return null;
|
||||||
|
if (click) return { click, ref: refHost || undefined, land, at: now };
|
||||||
|
if (external) return { ref: refHost, land, at: now };
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function attributionSuffix(a: Attribution | null, now: number): string {
|
||||||
|
if (!a || now - a.at >= ATTR_TTL_MS) return '';
|
||||||
|
const parts: string[] = [];
|
||||||
|
if (a.utm) {
|
||||||
|
const u = a.utm;
|
||||||
|
parts.push('utm:' + [u.utm_source ?? '-', u.utm_medium ?? '-', u.utm_campaign ?? '-'].join('/'));
|
||||||
|
if (u.utm_content) parts.push('content:' + u.utm_content);
|
||||||
|
if (u.utm_term) parts.push('term:' + u.utm_term);
|
||||||
|
}
|
||||||
|
if (a.click) parts.push('click:' + a.click);
|
||||||
|
if (a.ref) parts.push('ref:' + a.ref);
|
||||||
|
parts.push('land:' + a.land.slice(0, 80));
|
||||||
|
return ' | ' + parts.join(' | ');
|
||||||
|
}
|
||||||
|
|
||||||
|
function read(): Attribution | null {
|
||||||
|
const m = document.cookie.match(new RegExp('(?:^|; )' + ATTR_KEY + '=([^;]*)'));
|
||||||
|
if (!m) return null;
|
||||||
|
try {
|
||||||
|
return JSON.parse(decodeURIComponent(m[1])) as Attribution;
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('[attribution] 유입 기록을 읽지 못했습니다', e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 앱 시작 때 한 번 부른다(main.tsx). SPA 라 첫 진입 주소에 utm 이 있다. */
|
||||||
|
export function captureAttribution(): void {
|
||||||
|
const host = location.hostname;
|
||||||
|
const rec = nextAttribution(read(), location.search, document.referrer, host, host + location.pathname, Date.now());
|
||||||
|
if (!rec) return;
|
||||||
|
const domain = /(^|\.)webforai\.kr$/.test(host) ? '; Domain=.webforai.kr' : '';
|
||||||
|
const secure = location.protocol === 'https:' ? '; Secure' : '';
|
||||||
|
document.cookie = `${ATTR_KEY}=${encodeURIComponent(JSON.stringify(rec))}; Max-Age=${ATTR_TTL_MS / 1000}; Path=/${domain}; SameSite=Lax${secure}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 문의 source 에 붙일 꼬리. */
|
||||||
|
export function currentAttributionSuffix(): string {
|
||||||
|
return attributionSuffix(read(), Date.now());
|
||||||
|
}
|
||||||
@@ -24,6 +24,8 @@ export interface LeadInput {
|
|||||||
website: string;
|
website: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import { currentAttributionSuffix } from './attribution';
|
||||||
|
|
||||||
export type LeadResult = { ok: true } | { ok: false; reason: 'failed' };
|
export type LeadResult = { ok: true } | { ok: false; reason: 'failed' };
|
||||||
|
|
||||||
export async function submitLead(input: LeadInput): Promise<LeadResult> {
|
export async function submitLead(input: LeadInput): Promise<LeadResult> {
|
||||||
@@ -31,7 +33,8 @@ export async function submitLead(input: LeadInput): Promise<LeadResult> {
|
|||||||
const res = await fetch('/api/lead', {
|
const res = await fetch('/api/lead', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(input),
|
// 유입 경로(UTM 등)를 source 뒤에 붙인다. 화면 분석 이벤트에는 붙이지 않는다(ContactModal 은 원래 source 만 보냄)
|
||||||
|
body: JSON.stringify({ ...input, source: input.source + currentAttributionSuffix() }),
|
||||||
});
|
});
|
||||||
const data = await res.json().catch(() => null);
|
const data = await res.json().catch(() => null);
|
||||||
// 성공했다고 말할 근거가 없으면 실패로 둔다. 화면은 메일 폴백을 보여준다.
|
// 성공했다고 말할 근거가 없으면 실패로 둔다. 화면은 메일 폴백을 보여준다.
|
||||||
|
|||||||
@@ -25,8 +25,11 @@ import PrivacyPage from './pages/PrivacyPage.tsx';
|
|||||||
import TermsPage from './pages/TermsPage.tsx';
|
import TermsPage from './pages/TermsPage.tsx';
|
||||||
import SampleReportPage from './pages/SampleReportPage.tsx';
|
import SampleReportPage from './pages/SampleReportPage.tsx';
|
||||||
import { DISCOVERY_SITE, SHOW_PRICING, SHOW_SAMPLE_REPORT } from './lib/site';
|
import { DISCOVERY_SITE, SHOW_PRICING, SHOW_SAMPLE_REPORT } from './lib/site';
|
||||||
|
import { captureAttribution } from './lib/attribution';
|
||||||
import './index.css';
|
import './index.css';
|
||||||
|
|
||||||
|
captureAttribution();
|
||||||
|
|
||||||
|
|
||||||
createRoot(document.getElementById('root')!).render(
|
createRoot(document.getElementById('root')!).render(
|
||||||
<StrictMode>
|
<StrictMode>
|
||||||
|
|||||||
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#E4405F" d="M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077"/></svg>
|
||||||
|
After Width: | Height: | Size: 2.0 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#3C1E1E" d="M22.125 0H1.875C.8394 0 0 .8394 0 1.875v20.25C0 23.1606.8394 24 1.875 24h20.25C23.1606 24 24 23.1606 24 22.125V1.875C24 .8394 23.1606 0 22.125 0zM12 18.75c-.591 0-1.1697-.0413-1.7317-.1209-.5626.3965-3.813 2.6797-4.1198 2.7225 0 0-.1258.0489-.2328-.0141s-.0876-.2282-.0876-.2282c.0322-.2198.8426-3.0183.992-3.5333-2.7452-1.36-4.5701-3.7686-4.5701-6.5135C2.25 6.8168 6.6152 3.375 12 3.375s9.75 3.4418 9.75 7.6875c0 4.2457-4.3652 7.6875-9.75 7.6875zM8.0496 9.8672h-.8777v3.3417c0 .2963-.2523.5372-.5625.5372s-.5625-.2409-.5625-.5372V9.8672h-.8777c-.3044 0-.552-.2471-.552-.5508s.2477-.5508.552-.5508h2.8804c.3044 0 .552.2471.552.5508s-.2477.5508-.552.5508zm10.9879 2.9566a.558.558 0 0 1 .108.4167.5588.5588 0 0 1-.2183.371.5572.5572 0 0 1-.3383.1135.558.558 0 0 1-.4493-.2236l-1.3192-1.7479-.1952.1952v1.2273a.5635.5635 0 0 1-.5627.5628.563.563 0 0 1-.5625-.5625V9.3281c0-.3102.2523-.5625.5625-.5625s.5625.2523.5625.5625v1.209l1.5694-1.5694c.0807-.0807.1916-.1252.312-.1252.1404 0 .2814.0606.3871.1661.0985.0984.1573.2251.1654.3566.0082.1327-.036.2542-.1241.3425l-1.2818 1.2817 1.3845 1.8344zm-8.3502-3.5023c-.095-.2699-.3829-.5475-.7503-.5557-.3663.0083-.6542.2858-.749.5551l-1.3455 3.5415c-.1708.5305-.0217.7272.1333.7988a.8568.8568 0 0 0 .3576.0776c.2346 0 .4139-.0952.4678-.2481l.2787-.7297 1.7152.0001.2785.7292c.0541.1532.2335.2484.4681.2484a.8601.8601 0 0 0 .3576-.0775c.1551-.0713.3041-.2681.1329-.7999l-1.3449-3.5398zm-1.3116 2.4433l.5618-1.5961.5618 1.5961H9.3757zm5.9056 1.3836c0 .2843-.2418.5156-.5391.5156h-1.8047c-.2973 0-.5391-.2314-.5391-.5156V9.3281c0-.3102.2576-.5625.5742-.5625s.5742.2523.5742.5625v3.3047h1.1953c.2974 0 .5392.2314.5392.5156z"/></svg>
|
||||||
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#03C75A" d="M16.273 12.845 7.376 0H0v24h7.726V11.156L16.624 24H24V0h-7.727v12.845Z"/></svg>
|
||||||
|
After Width: | Height: | Size: 174 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#03C75A" d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7Zm0 9.5a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5Z"/></svg>
|
||||||
|
After Width: | Height: | Size: 207 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#FF0000" d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"/></svg>
|
||||||
|
After Width: | Height: | Size: 452 B |
@@ -57,5 +57,97 @@
|
|||||||
"mapQuery": "MOPRO Clinic 157 Dosan-daero Gangnam-gu Seoul"
|
"mapQuery": "MOPRO Clinic 157 Dosan-daero Gangnam-gu Seoul"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"_enNote": "2026-10-12 영문 값. 병원명·주소·원장 영문명은 공식 영문 페이지(mopro.co.kr/en/home/)와 홈페이지 구조화 데이터(employee 'Kunhak Moon') 표기. 대표자 '문건학'은 홈페이지 푸터 '대표자 : 문건학'(자동 수집값 '블로그'는 오류). sponsorNoticeEn·sideEffectNoticeEn·taglineEn 은 Claude 번역 초안으로 병원 확인 대기(haewon 결정 2026-10-12: 템플릿 규칙과 달리 영문 초안으로 교체). 강남언니 수치는 docs/reports/mopro/data/offsite.md 실측(2026-10-08). factSheetPatch·factSheetEn 은 워커가 읽지 않으므로 patch_site.py 가 적용한다."
|
"_enNote": "2026-10-12 영문 값. 병원명·주소·원장 영문명은 공식 영문 페이지(mopro.co.kr/en/home/)와 홈페이지 구조화 데이터(employee 'Kunhak Moon') 표기. 대표자 '문건학'은 홈페이지 푸터 '대표자 : 문건학'(자동 수집값 '블로그'는 오류). sponsorNoticeEn·sideEffectNoticeEn·taglineEn 은 Claude 번역 초안으로 병원 확인 대기(haewon 결정 2026-10-12: 템플릿 규칙과 달리 영문 초안으로 교체). 강남언니 수치는 docs/reports/mopro/data/offsite.md 실측(2026-10-08). factSheetPatch·factSheetEn 은 워커가 읽지 않으므로 patch_site.py 가 적용한다.",
|
||||||
}
|
"interview": {
|
||||||
|
"video": {
|
||||||
|
"id": "lzx2z4cWJt0",
|
||||||
|
"title": "[라스트닥터 3주년 인터뷰] 매출보다 직원행복 챙겼더니 일어난 3가지 변화",
|
||||||
|
"published": "2026-10-10",
|
||||||
|
"channel": "유튜브 @the_lastdoctor",
|
||||||
|
"titleEn": "Third-anniversary interview: what changed after putting staff before revenue (in Korean)",
|
||||||
|
"channelEn": "YouTube @the_lastdoctor"
|
||||||
|
},
|
||||||
|
"links": [
|
||||||
|
{
|
||||||
|
"cat": "밀착 인터뷰 · 네이버 블로그",
|
||||||
|
"title": "모발설계자 문건학 원장 밀착인터뷰 _ 보이는 것 너머, 시간을 설계하다",
|
||||||
|
"desc": "문건학 원장 인터뷰 원문을 블로그에서 읽을 수 있습니다.",
|
||||||
|
"url": "https://blog.naver.com/all_artist/224436053883",
|
||||||
|
"foot": "2026-10-09 게시 · blog.naver.com/all_artist",
|
||||||
|
"catEn": "Interview · Naver Blog",
|
||||||
|
"titleEn": "In-depth interview with Dr. Kunhak Moon (in Korean)",
|
||||||
|
"descEn": "Read the full interview with Dr. Kunhak Moon on the original blog.",
|
||||||
|
"footEn": "Published 2026-10-09 · blog.naver.com/all_artist"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cat": "공식 블로그",
|
||||||
|
"title": "모프로의원 네이버 블로그",
|
||||||
|
"desc": "모발이식·탈모 치료 정보를 모프로의원이 직접 올리는 블로그입니다.",
|
||||||
|
"url": "https://blog.naver.com/moprohair",
|
||||||
|
"foot": "blog.naver.com/moprohair",
|
||||||
|
"catEn": "Official Blog",
|
||||||
|
"titleEn": "MOPRO Clinic Naver Blog (in Korean)",
|
||||||
|
"descEn": "Hair transplant and hair loss treatment information posted by the clinic.",
|
||||||
|
"footEn": "blog.naver.com/moprohair"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cat": "인스타그램",
|
||||||
|
"title": "모프로의원 인스타그램",
|
||||||
|
"desc": "모프로의원 공식 인스타그램 계정입니다.",
|
||||||
|
"url": "https://www.instagram.com/moproclinic/",
|
||||||
|
"foot": "@moproclinic",
|
||||||
|
"catEn": "Instagram",
|
||||||
|
"titleEn": "MOPRO Clinic Instagram",
|
||||||
|
"descEn": "The clinic's official Instagram account.",
|
||||||
|
"footEn": "@moproclinic"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"_interviewNote": "2026-10-19 haewon 지시로 홈 'Interview' 섹션에 싣는다. 영상은 외부 채널(@the_lastdoctor) 인터뷰라 캡션에 그 채널을 밝힌다. 밀착인터뷰는 외부 에이전시 블로그(all_artist) 글이라 제목·링크만 싣고 본문은 옮기지 않는다(haewon 결정 2026-10-19). 게시일은 유튜브 uploadDate(2026-10-09 PDT)·블로그 게시 표기 실측. patch_site.py 가 src/data/interview.json 으로 쓴다. 2026-10-19 영문 홈에도 싣는다(haewon 지시). *En 값은 Claude 번역 초안이며, 한국어 콘텐츠는 제목에 '(in Korean)'을 붙인다.",
|
||||||
|
"footerChannels": [
|
||||||
|
{
|
||||||
|
"label": "유튜브",
|
||||||
|
"labelEn": "YouTube",
|
||||||
|
"url": "https://www.youtube.com/@moproclinic",
|
||||||
|
"icon": "youtube.svg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "인스타그램",
|
||||||
|
"labelEn": "Instagram",
|
||||||
|
"url": "https://www.instagram.com/moproclinic/",
|
||||||
|
"icon": "instagram.svg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "네이버 블로그",
|
||||||
|
"labelEn": "Naver Blog",
|
||||||
|
"url": "https://blog.naver.com/moprohair",
|
||||||
|
"icon": "naverblog.svg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "카카오톡 채널",
|
||||||
|
"labelEn": "KakaoTalk Channel",
|
||||||
|
"url": "https://pf.kakao.com/_rjAVG",
|
||||||
|
"icon": "kakaotalk.svg",
|
||||||
|
"bg": "#FEE500"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "네이버 플레이스",
|
||||||
|
"labelEn": "Naver Place",
|
||||||
|
"url": "https://m.place.naver.com/hospital/1821744096/home",
|
||||||
|
"icon": "naverplace.svg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "강남언니",
|
||||||
|
"labelEn": "Gangnam Unni",
|
||||||
|
"url": "https://www.gangnamunni.com/hospitals/5447",
|
||||||
|
"icon": "gangnamunni.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "바비톡",
|
||||||
|
"labelEn": "Babitalk",
|
||||||
|
"url": "https://babitalk.com/hospitals/4372",
|
||||||
|
"icon": "babitalk.png"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_footerChannelsNote": "2026-10-19 haewon 지시로 푸터에 채널 아이콘을 싣는다. URL은 docs/reports/mopro/data/offsite.md 실측(2026-10-08). 블로그는 haewon이 '콘텐츠 메인'으로 준 moprohair(팩트 시트 자동 수집값 moproclinic은 기존 사례연구 블로그). Facebook 2개(팔로워 5·25, 홈페이지 링크 없음)·TikTok(팔로워 0)은 넣지 않았다. 아이콘: 유튜브·인스타그램·네이버·카카오톡은 simple-icons(CC0), 강남언니·바비톡은 각 사이트 파비콘, 플레이스는 지도 핀. patch_site.py 가 channel-icons/ 를 public/img/channels/ 로 복사한다."
|
||||||
|
}
|
||||||
@@ -12,12 +12,15 @@
|
|||||||
2. 회복 일정 캘린더 파일 정보(PRODID·UID)에 남은 다른 병원 이름을 INFINITH·모프로로 바꾼다
|
2. 회복 일정 캘린더 파일 정보(PRODID·UID)에 남은 다른 병원 이름을 INFINITH·모프로로 바꾼다
|
||||||
3. clinic.json excludeImages 에 해당하는 파일을 public/img 전체에서 지운다(워커는 img/clinic 만 지운다)
|
3. clinic.json excludeImages 에 해당하는 파일을 public/img 전체에서 지운다(워커는 img/clinic 만 지운다)
|
||||||
3b. 영문 화면의 한글 노출을 정리한다(영문 사이트 이름·대표자·빈 값 문구, 팩트 시트 영문 값, 사진 없는 장소 이름 칸)
|
3b. 영문 화면의 한글 노출을 정리한다(영문 사이트 이름·대표자·빈 값 문구, 팩트 시트 영문 값, 사진 없는 장소 이름 칸)
|
||||||
|
3c. 한국어·영문 홈에 'Interview' 섹션(원장 인터뷰 영상·인터뷰 글·공식 블로그·인스타그램)을 넣는다(clinic.json interview)
|
||||||
|
3d. 푸터에 채널 아이콘 줄(유튜브·인스타그램·블로그·카카오톡·플레이스·강남언니·바비톡)을 넣는다(clinic.json footerChannels)
|
||||||
4. vercel.json 사이트 주소를 정식 주소로 넣고, 공유 이미지(og.jpg)를 '서포터즈' 없는 상단 문구로 다시 그린다
|
4. vercel.json 사이트 주소를 정식 주소로 넣고, 공유 이미지(og.jpg)를 '서포터즈' 없는 상단 문구로 다시 그린다
|
||||||
5. src 에 화면용 '서포터즈'가 남아 있으면 실패로 끝낸다
|
5. src 에 화면용 '서포터즈'가 남아 있으면 실패로 끝낸다
|
||||||
"""
|
"""
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -131,6 +134,148 @@ def patch_english():
|
|||||||
return changed
|
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 ?"),
|
||||||
|
# 영문 홈에서 쓸 수 있게 lang='en' 이면 재생 버튼 설명·썸네일 대체 문구·게시일 표기를 영어로 낸다
|
||||||
|
("channel?: string }", "channel?: string; lang?: string }"),
|
||||||
|
("compact = false, channel }", "compact = false, channel, lang }"),
|
||||||
|
("aria-label={`영상 재생: ${title}`}", "aria-label={lang === 'en' ? `Play video: ${title}` : `영상 재생: ${title}`}"),
|
||||||
|
("alt={`유튜브 영상 썸네일: ${title}`}", "alt={lang === 'en' ? `YouTube video thumbnail: ${title}` : `유튜브 영상 썸네일: ${title}`}"),
|
||||||
|
("{published ? `${published} 게시 · ` : ''}", "{published ? (lang === 'en' ? `Published ${published} · ` : `${published} 게시 · `) : ''}"),
|
||||||
|
]
|
||||||
|
# 영문 홈 Interview 섹션: Clinic Facts 아래, Principles 위. 값은 clinic.json interview 의 *En
|
||||||
|
INTERVIEW_EN_ANCHOR = " <section class=\"section dark\"><div class=\"wrap-wide\">\n <div class=\"sec-head\"><div class=\"eyebrow\" style=\"color:var(--purple-300)\">Principles</div>"
|
||||||
|
INTERVIEW_EN_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">Interviews with Dr. Kunhak Moon and the clinic's official channels.</p></div>
|
||||||
|
<div class="interview-grid">
|
||||||
|
{interview.video && <div class="interview-video"><VideoLite id={interview.video.id} title={interview.video.titleEn} published={interview.video.published} channel={interview.video.channelEn} lang="en" /></div>}
|
||||||
|
{interview.links.map((l) => (
|
||||||
|
<article class="card">
|
||||||
|
<div class="cat">{l.catEn}</div>
|
||||||
|
<h3><a href={l.url} rel="noopener" target="_blank">{l.titleEn}</a></h3>
|
||||||
|
<p>{l.descEn}</p>
|
||||||
|
<div class="foot">{l.footEn}</div>
|
||||||
|
</article>
|
||||||
|
))}
|
||||||
|
</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>
|
||||||
|
</div></section>
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
||||||
|
changed = 0
|
||||||
|
ip = os.path.join(SITE, "src/pages/index.astro")
|
||||||
|
text = open(ip, encoding="utf-8").read()
|
||||||
|
if "data/interview.json" not in text:
|
||||||
|
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)
|
||||||
|
changed += 1
|
||||||
|
ep = os.path.join(SITE, "src/pages/en/index.astro")
|
||||||
|
text = open(ep, encoding="utf-8").read()
|
||||||
|
if "data/interview.json" not in text:
|
||||||
|
if INTERVIEW_EN_ANCHOR not in text:
|
||||||
|
sys.exit("en/index.astro 에서 Principles 섹션을 찾지 못해 Interview 섹션을 넣지 못함")
|
||||||
|
text = text.replace("import VisitMap from '../../components/VisitMap.astro';",
|
||||||
|
"import VisitMap from '../../components/VisitMap.astro';\nimport VideoLite from '../../components/VideoLite.astro';\nimport interview from '../../data/interview.json';", 1)
|
||||||
|
text = text.replace(INTERVIEW_EN_ANCHOR, INTERVIEW_EN_SECTION + INTERVIEW_EN_ANCHOR, 1)
|
||||||
|
open(ep, "w", encoding="utf-8").write(text)
|
||||||
|
changed += 1
|
||||||
|
return changed
|
||||||
|
|
||||||
|
|
||||||
|
# 푸터 채널 아이콘 (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():
|
def remove_excluded_images():
|
||||||
prefixes = json.load(open(os.path.join(HERE, "clinic.json"), encoding="utf-8")).get("excludeImages", [])
|
prefixes = json.load(open(os.path.join(HERE, "clinic.json"), encoding="utf-8")).get("excludeImages", [])
|
||||||
removed = []
|
removed = []
|
||||||
@@ -170,6 +315,8 @@ if __name__ == "__main__":
|
|||||||
n = patch_copy()
|
n = patch_copy()
|
||||||
n_en = patch_english()
|
n_en = patch_english()
|
||||||
print(f"영문 처리 {n_en}곳")
|
print(f"영문 처리 {n_en}곳")
|
||||||
|
print(f"홈 인터뷰 섹션 {patch_home_interview()}곳")
|
||||||
|
print(f"푸터 채널 아이콘 {patch_footer_channels()}곳")
|
||||||
removed = remove_excluded_images()
|
removed = remove_excluded_images()
|
||||||
set_site_url_and_share_image()
|
set_site_url_and_share_image()
|
||||||
left = leftovers()
|
left = leftovers()
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import { test } from 'node:test';
|
||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import { nextAttribution, attributionSuffix, ATTR_TTL_MS } from '../src/lib/attribution.ts';
|
||||||
|
|
||||||
|
const NOW = 1_800_000_000_000;
|
||||||
|
const H = 'infinith.webforai.kr';
|
||||||
|
|
||||||
|
test('utm 기록과 꼬리', () => {
|
||||||
|
const a = nextAttribution(null, '?utm_source=naver_blog&utm_medium=organic&utm_campaign=2611_h', '', H, H + '/', NOW);
|
||||||
|
assert.equal(attributionSuffix(a, NOW), ' | utm:naver_blog/organic/2611_h | land:infinith.webforai.kr/');
|
||||||
|
});
|
||||||
|
test('webforai.kr 에서 넘어온 것은 같은 사이트', () => {
|
||||||
|
assert.equal(nextAttribution(null, '', 'https://webforai.kr/', H, H + '/', NOW), null);
|
||||||
|
});
|
||||||
|
test('외부 유입은 살아 있는 utm 을 덮지 않고, 없으면 ref', () => {
|
||||||
|
const u = nextAttribution(null, '?utm_source=facebook', '', H, H + '/', NOW);
|
||||||
|
assert.equal(nextAttribution(u, '', 'https://blog.naver.com/x', H, H + '/', NOW + 1), null);
|
||||||
|
const r = nextAttribution(null, '', 'https://blog.naver.com/x', H, H + '/', NOW);
|
||||||
|
assert.equal(attributionSuffix(r, NOW), ' | ref:blog.naver.com | land:infinith.webforai.kr/');
|
||||||
|
assert.equal(attributionSuffix(r, NOW + ATTR_TTL_MS), '');
|
||||||
|
});
|
||||||