From bad509d6c1ee5a0cbe8230c95d6d59b3a875a5c0 Mon Sep 17 00:00:00 2001 From: caesiumy Date: Thu, 21 May 2026 08:28:39 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix(seo):=20noindex=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=EC=97=90=20JSON-LD=20=EA=B5=AC=EC=A1=B0=ED=99=94=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=AF=B8=EB=A0=8C=EB=8D=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pageType="profile"을 전달하는 레이아웃은 AboutLayout(/about)과 PortfolioLayout(/portfolio) 두 개다. Person JSON-LD의 url이 ${SITE.website}/about로 고정돼 있어, noindex 페이지인 /portfolio에도 Person 구조화 데이터가 렌더되고 url이 잘못 /about을 가리켰다. robots prop에 noindex가 포함되면 JSON-LD를 렌더하지 않도록 게이팅했다. 검색엔진은 색인하지 않을 페이지의 구조화 데이터를 사용하지 않으므로, portfolio 전용 분기가 아닌 일반 규칙으로 처리해 향후 추가될 noindex 페이지에도 자동 적용된다. /about의 출력은 변경되지 않는다. --- src/layouts/Layout.astro | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index d3b014b..f1b6a24 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -39,9 +39,13 @@ const keywords = tags.length > 0 ? tags : SITE.keywords; const socialImageURL = new URL(ogImage, Astro.url); +// noindex 페이지는 검색엔진이 색인하지 않으므로 구조화 데이터를 싣지 않는다 +const noindex = robots?.includes("noindex") ?? false; + // 페이지 타입에 따른 JSON-LD 구조화 데이터 -const structuredData = - pageType === "article" +const structuredData = noindex + ? null + : pageType === "article" ? { "@context": "https://schema.org", "@type": "BlogPosting", @@ -68,6 +72,7 @@ const structuredData = name: SITE.author, alternateName: SITE.authorEn, description: SITE.authorDescription, + // 인물의 정규 프로필 페이지(고정값). 현재 페이지 canonical이 아님. url: `${SITE.website}/about`, image: `${socialImageURL}`, sameAs: [SITE.social.github, SITE.social.linkedin], @@ -187,11 +192,15 @@ const structuredData = -