From 4216a05fca4657442105fb8c8e17f076dafee38e Mon Sep 17 00:00:00 2001 From: Mina Choi Date: Fri, 11 Sep 2026 14:08:48 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20site:=20=EC=82=AC=EC=9D=B4=ED=8A=B8?= =?UTF-8?q?=EB=A7=B5=C2=B7=EB=AA=A9=EB=A1=9D=C2=B7llms.txt=20=EC=97=90?= =?UTF-8?q?=EC=84=9C=20noindex=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=A0=9C?= =?UTF-8?q?=EC=99=B8=20=E2=80=94=20=EB=AA=A9=EC=97=85=20=EB=B3=B5=EC=A0=9C?= =?UTF-8?q?=EB=B3=B8=EC=9D=B4=20/s/stay=20=EB=A5=BC=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EB=B0=80=EC=96=B4=EB=82=B8=20=EA=B2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /s/stay 가 "스테이머뭄" 구글 검색에서 통째로 빠졌다. out/s/ 에 목업·백업(stay2 · stay3 · stay.old)이 운영본과 제목·본문이 같은 채(단어 87%) 각자 자기를 canonical 로 가리키고 있었고, 사이트맵·/s 목록이 디렉토리를 훑어 이들을 전부 구글에 제출했다 — 같은 글 여러 벌 중 구글이 하나만 고른다. 목업 셋은 운영 볼륨에서 noindex 로 바꿨고(2026-09-11), 이 커밋은 그런 페이지가 다시 제출되지 않게 한다. - seo/directory.ts: readBakedNoindex — 구운 HTML 의 robots 메타를 읽는다. 슬러그 이름(.old)으로 거르지 않는다 — 페이지 자신의 선언이 유일한 출처다 - prerender.ts writeRootMachineFiles: noindex 페이지를 사이트맵·/s 목록·루트 llms.txt 에서 뺀다. 남겨 두면 서치콘솔이 "제출된 URL 에 noindex" 를 계속 띄운다 vitest directory.test.ts 8 passed · tsc·eslint 통과 Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01CEQ9auj65yJKk2MnWbtRqU --- solution/site/scripts/prerender.ts | 9 ++++++--- solution/site/src/seo/directory.test.ts | 19 ++++++++++++++++++- solution/site/src/seo/directory.ts | 15 +++++++++++++++ 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/solution/site/scripts/prerender.ts b/solution/site/scripts/prerender.ts index d356bad..6807767 100644 --- a/solution/site/scripts/prerender.ts +++ b/solution/site/scripts/prerender.ts @@ -23,6 +23,7 @@ import { collectJsonLd, homeMeta, readBakedLastmod, + readBakedNoindex, readBakedTitle, renderHead, renderLlmsTxt, @@ -715,9 +716,11 @@ function writeRootMachineFiles(outRoot: string, origin: string) { .map((entry) => ({slug: entry.name, file: join(sitesDir, entry.name, 'index.html')})) // index.html 이 없으면 발행이 끝나지 않은(또는 실패한) 디렉토리다. 사이트맵에 넣지 않는다. .filter((entry) => existsSync(entry.file)) - .map((entry) => { - // 제목과 lastmod 가 같은 HTML 에서 나온다 — 파일은 한 번만 읽는다. - const html = readFileSync(entry.file, 'utf-8'); + // 제목·lastmod·noindex 가 같은 HTML 에서 나온다 — 파일은 한 번만 읽는다. + .map((entry) => ({...entry, html: readFileSync(entry.file, 'utf-8')})) + // ★ noindex 를 선언한 페이지(목업·백업)는 싣지 않는다 — readBakedNoindex 주석 참조. + .filter((entry) => !readBakedNoindex(entry.html)) + .map(({html, ...entry}) => { return { // ★ 끝 슬래시를 붙이지 않는다. 페이지의 canonical 은 `/s/` 다(shared/lib/slug.ts // publishUrl). 사이트맵이 `/s//` 로 어긋나 있던 동안 서치콘솔은 제출한 URL 을 diff --git a/solution/site/src/seo/directory.test.ts b/solution/site/src/seo/directory.test.ts index 958cedf..cee3056 100644 --- a/solution/site/src/seo/directory.test.ts +++ b/solution/site/src/seo/directory.test.ts @@ -10,7 +10,7 @@ import {describe, expect, it} from 'vitest'; import {MOONLIGHT_STAY_PAYLOAD} from '../fixtures/moonlight-stay'; -import {readBakedLastmod, readBakedTitle} from './directory'; +import {readBakedLastmod, readBakedNoindex, readBakedTitle} from './directory'; import {renderHead} from './head'; import {homeMeta} from './meta'; @@ -44,3 +44,20 @@ describe('readBakedTitle', () => { expect(readBakedTitle('')).toBe(''); }); }); + +describe('readBakedNoindex', () => { + it('발행본 head 는 index 다 — 사이트맵에 남는다', () => { + expect(readBakedNoindex(bakedHead())).toBe(false); + }); + + it('noindex 를 선언한 목업은 걸러진다', () => { + const mockup = + ''; + expect(readBakedNoindex(mockup)).toBe(true); + expect(readBakedNoindex('')).toBe(true); + }); + + it('robots 메타가 없으면 색인 대상으로 친다', () => { + expect(readBakedNoindex('x')).toBe(false); + }); +}); diff --git a/solution/site/src/seo/directory.ts b/solution/site/src/seo/directory.ts index 0fa9c87..67c8948 100644 --- a/solution/site/src/seo/directory.ts +++ b/solution/site/src/seo/directory.ts @@ -20,6 +20,21 @@ export function readBakedTitle(html: string): string { return match ? match[1].trim() : ''; } +/** + * 페이지가 스스로 `noindex` 를 선언했나. 그런 페이지는 사이트맵·`/s` 목록·llms.txt 에 싣지 않는다. + * + * ★ 왜 — `out/s/` 에는 payload 없는 목업·백업(`stay2` · `stay3` · `*.old`)이 섞여 있고, 목록은 + * 디렉토리를 훑어 만든다. 목업은 운영본(`/s/stay`)의 복제라 제목·본문이 같은데 canonical 은 + * 각자 자기를 가리켰다 — 구글은 같은 글 여러 벌 중 하나만 고르고, 실측(2026-09-11) 운영본이 + * "스테이머뭄" 검색에서 통째로 빠졌다. 목업에 noindex 를 박는 것만으로는 절반이다 — 사이트맵에 + * 남아 있으면 서치콘솔이 "제출된 URL 에 noindex" 오류를 계속 띄운다. + * ★ 슬러그 이름 규칙(`.old` 등)으로 거르지 않는다 — 페이지 자신의 선언이 유일한 출처다. + */ +export function readBakedNoindex(html: string): boolean { + const match = /