o2o-infinith-demo/src/entry-server.tsx
Haewon Kam 13f8c362c2 feat: 랜딩 AI 크롤러 가독성 — SSR 프리렌더 + 메타/JSON-LD + robots/sitemap/llms.txt
- src/entry-server.tsx + scripts/prerender.ts: 빌드 시 / 를 renderToString으로 정적 HTML 주입 (크롤러 본문 4단어 → 800+단어)
- main.tsx: 프리렌더된 랜딩은 hydrateRoot, 나머지 라우트는 createRoot
- index.html: lang=ko, description/OG/canonical, Organization·SoftwareApplication·WebSite JSON-LD
- public/: robots.txt(AI 크롤러 명시 허용), sitemap.xml, llms.txt (SPA 리라이트로 index.html 반환되던 문제 해소)
- Badge.tsx: 메인 체크아웃에만 있고 미커밋이던 컴포넌트 추가 (빌드 실패 원인)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-28 15:43:47 +09:00

24 lines
838 B
TypeScript

// 빌드 시 랜딩(/)만 정적 HTML로 프리렌더하는 서버 엔트리.
// AI 크롤러(GPTBot/ClaudeBot/PerplexityBot)는 JS를 실행하지 않으므로
// 본문이 HTML에 직접 들어 있어야 인용 가능하다. scripts/prerender.ts에서 호출.
import { StrictMode } from 'react';
import { renderToString } from 'react-dom/server';
import { StaticRouter } from 'react-router';
import { Routes, Route } from 'react-router';
import App from './App.tsx';
import LandingPage from './pages/LandingPage.tsx';
export function render(url: string): string {
return renderToString(
<StrictMode>
<StaticRouter location={url}>
<Routes>
<Route element={<App />}>
<Route index element={<LandingPage />} />
</Route>
</Routes>
</StaticRouter>
</StrictMode>,
);
}