first commit
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import { REGIONS_DATA } from '../src/data/regions.js';
|
||||
import { TARGETS, SUBJECTS } from '../src/data/subjects.js';
|
||||
|
||||
// 사이트맵 / 사전 렌더링 공용: 색인 대상 랜딩 페이지 경로 전체
|
||||
export function getLandingPaths() {
|
||||
const paths = [];
|
||||
REGIONS_DATA.forEach((sido) => {
|
||||
sido.sigunguList.forEach((sigungu) => {
|
||||
sigungu.dongList.forEach((dong) => {
|
||||
TARGETS.forEach((target) => {
|
||||
SUBJECTS.forEach((sub) => {
|
||||
paths.push(`/${sido.sidoSlug}/${sigungu.sigunguSlug}/${dong.dongSlug}/${target.slug}/${sub.slug}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
return paths;
|
||||
}
|
||||
|
||||
// 시도별 랜딩 페이지 경로 조회
|
||||
export function getLandingPathsForSido(sidoSlug) {
|
||||
const paths = [];
|
||||
const targetSido = REGIONS_DATA.find((s) => s.sidoSlug === sidoSlug);
|
||||
if (!targetSido) return paths;
|
||||
|
||||
targetSido.sigunguList.forEach((sigungu) => {
|
||||
sigungu.dongList.forEach((dong) => {
|
||||
TARGETS.forEach((target) => {
|
||||
SUBJECTS.forEach((sub) => {
|
||||
paths.push(`/${targetSido.sidoSlug}/${sigungu.sigunguSlug}/${dong.dongSlug}/${target.slug}/${sub.slug}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
return paths;
|
||||
}
|
||||
|
||||
// 사전 렌더링(SSG) 대상 경로
|
||||
// OneDrive 동기화 잠금 및 Cloudflare 대시보드 폴더 탐색 멈춤(무한 업로드)을 방지하기 위해
|
||||
// 물리적 중첩 폴더는 대표 핵심 경로만 최소한으로 생성하고 _redirects (200 OK) 로 전체 라우팅을 처리합니다.
|
||||
export function getPrerenderPaths() {
|
||||
const isAll = process.env.PRERENDER_ALL === 'true';
|
||||
if (isAll) {
|
||||
return getLandingPaths();
|
||||
}
|
||||
return [
|
||||
'/daegu/suseong-gu/hwanggeum-dong/middle/math',
|
||||
'/incheon/yeonsu-gu/songdo-dong/middle/math',
|
||||
'/seoul/gangnam-gu/daechi-dong/high/math',
|
||||
'/gyeonggi/seongnam-si-bundang-gu/sunae-dong/middle/english',
|
||||
'/busan/haeundae-gu/u-dong/middle/english'
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user