From a936444dfc2e319e5286baaa47a9c98d6e387fa6 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Mon, 31 Aug 2026 09:09:57 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=A6=B4=EB=A6=AC=EC=8A=A4=20=EB=85=B8?= =?UTF-8?q?=ED=8A=B8=EB=A5=BC=20=EB=AA=A9=EB=A1=9D=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=A0=9C=EB=8C=80=EB=A1=9C=20=EC=9D=BD=EA=B3=A0=20robots.txt?= =?UTF-8?q?=20=EB=A5=BC=20=EC=84=9C=EB=B9=99=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 릴리스 노트의 각 칸은 Markdown 인데 줄을 쪼개 `- ` 만 떼는 것이 전부였다. 그래서 작성자가 소제목으로 쓴 `## 작성` 이 항목 하나로 섞였고, `:::note` 와 `---`, `![대체](/...)` 도 글자 그대로 목록에 나왔다. 그 노트의 내용이 하필 "본문의 표·코드·callout·그림이 렌더링됩니다" 였다. 소제목·수평선·블록 울타리는 항목이 아니므로 버린다. 소제목까지 살리려면 화면이 절을 나눠야 하는데 이 칸은 「무엇이 바뀌었나」 아래의 한 목록이다. 번호 목록도 항목으로 읽는다. 백틱은 남겨 두고 화면이 코드로 그린다. robots.txt 가 404 였다. 파일은 이미지에 들어 있었지만 nginx 설정이 서빙할 파일을 하나씩 명시하는 구조라 등록되지 않은 것은 SPA 폴백으로 떨어진다 — 크롤러가 index.html 을 규칙으로 읽을 수는 없으므로 규칙이 없는 것과 같았다. 설명(meta)에서 백틱을 지운다. 본문에서는 코드가 되지만 검색 결과에는 그 문자가 그대로 나간다. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_011nAjrqNHGPNngN4aUbcyvJ --- scripts/generate-nginx-config.ts | 8 ++++++ .../adapters/http/public-content-mapping.ts | 16 +++++++++++- .../public/pages/release-page.tsx | 9 ++++--- .../shared/use-document-metadata.ts | 11 ++++++-- tests/component/prose-text.test.tsx | 26 +++++++++++++++++++ 5 files changed, 63 insertions(+), 7 deletions(-) diff --git a/scripts/generate-nginx-config.ts b/scripts/generate-nginx-config.ts index 5b0ef16..308ea6b 100644 --- a/scripts/generate-nginx-config.ts +++ b/scripts/generate-nginx-config.ts @@ -200,6 +200,14 @@ ${studioLocations} add_header Cache-Control "${assetCache}" always; } + # 크롤러가 처음 찾는 파일이다. 여기 없으면 SPA 폴백이 index.html 을 주고, + # 크롤러는 그것을 규칙으로 읽을 수 없어 결국 아무 규칙도 없는 것과 같아진다. + location = ${basePath}/robots.txt { + alias /usr/share/nginx/html/robots.txt; + default_type text/plain; + add_header Cache-Control "${indexCache}" always; + } + location = ${basePath}/media/ { return 404; } diff --git a/src/features/tech-log/adapters/http/public-content-mapping.ts b/src/features/tech-log/adapters/http/public-content-mapping.ts index e88a078..35d7dd0 100644 --- a/src/features/tech-log/adapters/http/public-content-mapping.ts +++ b/src/features/tech-log/adapters/http/public-content-mapping.ts @@ -95,13 +95,27 @@ export function markdownSections(body: string | null | undefined): RecordSection } /** Markdown that is really a list — the release document's four bodies are. */ +/** + * 릴리스 노트의 한 칸을 항목 목록으로 읽는다. + * + *

예전에는 줄을 쪼개고 `- ` 만 떼어 냈다. 그래서 작성자가 소제목으로 쓴 `## 작성` 이 항목 + * 하나로 섞여 들어갔고, `:::note` 나 `![대체](/...)` 같은 블록 문법도 글자 그대로 목록에 + * 나왔다. 그 릴리스 노트의 내용이 하필 "본문의 표·코드·callout·그림이 렌더링됩니다" 였다. + * + *

여기서 다루는 것은 목록이므로 소제목은 버린다 — 소제목까지 살리려면 화면이 절을 나눠야 + * 하는데, 이 칸은 「무엇이 바뀌었나」 아래의 한 목록이다. 백틱은 남겨서 화면이 코드로 그린다. + */ export function markdownLines(body: string | null | undefined): string[] { if (!body) return []; return body .split(/\r?\n/u) .map((line) => line.trim()) .filter((line) => line.length > 0) - .map((line) => line.replace(/^[-*]\s+/u, "")); + // 소제목·수평선·블록 울타리는 항목이 아니다. + .filter((line) => !/^#{1,6}\s/u.test(line)) + .filter((line) => !/^(?::::|---+|\*\*\*+)/u.test(line)) + .map((line) => line.replace(/^[-*]\s+/u, "")) + .map((line) => line.replace(/^\d+\.\s+/u, "")); } function slugOf(title: string, index: number): string { diff --git a/src/features/tech-log/presentation/public/pages/release-page.tsx b/src/features/tech-log/presentation/public/pages/release-page.tsx index f6d45ba..fb3de3c 100644 --- a/src/features/tech-log/presentation/public/pages/release-page.tsx +++ b/src/features/tech-log/presentation/public/pages/release-page.tsx @@ -5,6 +5,7 @@ import { useRouteInput, } from "../../../../../presentation/routes/route-input.tsx"; import { usePublicContent } from "../use-public-content.tsx"; +import { ProseText } from "../../shared/public-render/prose-text.tsx"; export function ReleasePage() { const { params } = useRouteInput<"TECH_LOG_RELEASE">(); @@ -26,7 +27,7 @@ export function ReleasePage() {

Release v{release.version}

{release.title}

-

{release.summary}

+
@@ -36,7 +37,7 @@ export function ReleasePage() {

무엇이 바뀌었나

    {release.changes.map((item) => ( -
  • {item}
  • +
  • ))}
@@ -47,7 +48,7 @@ export function ReleasePage() {

왜 바꿨나

    {release.reasons.map((item) => ( -
  • {item}
  • +
  • ))}
@@ -58,7 +59,7 @@ export function ReleasePage() {

영향

    {release.impacts.map((item) => ( -
  • {item}
  • +
  • ))}
diff --git a/src/features/tech-log/presentation/shared/use-document-metadata.ts b/src/features/tech-log/presentation/shared/use-document-metadata.ts index db37bf4..592afa6 100644 --- a/src/features/tech-log/presentation/shared/use-document-metadata.ts +++ b/src/features/tech-log/presentation/shared/use-document-metadata.ts @@ -20,8 +20,15 @@ export function useDocumentMetadata(title: string | undefined, description?: str document.title = `${title} · Tech Log`; if (element && description) { - // 설명은 한 줄이어야 한다 — 요약에 문단이 있으면 줄바꿈을 공백으로 접는다. - element.content = description.replace(/\s+/gu, " ").trim().slice(0, 200); + /* + 설명은 한 줄 평문이어야 한다. 줄바꿈을 접고, 작성자가 코드 표시로 쓴 백틱을 지운다 — + 본문에서는 `` 가 되지만 여기서는 검색 결과에 그 문자가 그대로 나간다. + */ + element.content = description + .replace(/`/gu, "") + .replace(/\s+/gu, " ") + .trim() + .slice(0, 200); } return () => { diff --git a/tests/component/prose-text.test.tsx b/tests/component/prose-text.test.tsx index 60c39c5..0d37596 100644 --- a/tests/component/prose-text.test.tsx +++ b/tests/component/prose-text.test.tsx @@ -50,3 +50,29 @@ describe("산문 칸", () => { expect(container.querySelectorAll("p")).toHaveLength(0); }); }); + +/** + * 릴리스 노트의 각 칸은 Markdown 으로 쓰이는데 목록으로만 읽혀서, 소제목과 블록 문법이 항목에 + * 섞여 나왔다. 그 노트의 내용이 하필 "본문의 표·코드·callout·그림이 렌더링됩니다" 였다. + */ +describe("릴리스 노트 목록 읽기", () => { + it("소제목·수평선·블록 울타리를 항목으로 세지 않는다", async () => { + const { markdownLines } = await import( + "../../src/features/tech-log/adapters/http/public-content-mapping.ts" + ); + expect( + markdownLines("## 작성\n\n- 편집 화면의 버튼을 줄였습니다.\n- 채워야 할 칸을 표시합니다.\n\n---\n\n## 본문 문법\n:::note\n- 표를 지원합니다."), + ).toEqual([ + "편집 화면의 버튼을 줄였습니다.", + "채워야 할 칸을 표시합니다.", + "표를 지원합니다.", + ]); + }); + + it("번호 목록도 항목으로 읽는다", async () => { + const { markdownLines } = await import( + "../../src/features/tech-log/adapters/http/public-content-mapping.ts" + ); + expect(markdownLines("1. 첫째\n2. 둘째")).toEqual(["첫째", "둘째"]); + }); +});