---
title: 테마·블로그 표시·분석 태그 설정
description: 어드민에서 관리하는 디자인 토큰, 블로그 표시 옵션, 분석 태그를 사이트에서 조회
---

# 테마·블로그 표시·분석 태그 설정

어드민에서 설정한 값을 공개 API로 조회해 사이트에 반영합니다. 모두
`@roottale/cms-client/server`에서 제공하며 같은 API 키를 사용합니다.

## 디자인 토큰 — fetchTheme

```ts
import { fetchTheme } from "@roottale/cms-client/server";

const theme = await fetchTheme({ apiKey: process.env.ROOTTALE_API_KEY! });
// theme.colors / theme.fonts / theme.radius — 어드민에서 설정한 토큰만 포함
```

토큰을 CSS 변수로 매핑해 렌더러 스타일과 사이트 스타일을 일치시킬 수
있습니다. 토큰 변경 시에도 발행 웹훅이 발송되어 캐시가 갱신됩니다.

## 블로그 표시 설정 — fetchBlogSettings

어드민의 블로그 표시 옵션(TOC 노출, 작성자/발행일 표시, 작성자 카드, 저자
프로필)을 조회합니다.

```ts
import {
  fetchBlogSettings,
  resolvePostDisplay,
  DEFAULT_BLOG_SETTINGS,
} from "@roottale/cms-client/server";

const settings = await fetchBlogSettings({
  apiKey: process.env.ROOTTALE_API_KEY!,
});
// showTableOfContents, showAuthor, showDate, showAuthorCard,
// tocTitle, authorProfileName / Bio / ImageUrl 등

// 글 단위 오버라이드(metaJson)와 합성해 최종 표시값 계산
const display = resolvePostDisplay(settings, post);
```

`RootTaleBlogPost` 컴포넌트를 쓰면 이 설정이 자동 반영됩니다 — 커스텀 UI를
만들 때만 직접 조회하면 됩니다.

## 비즈니스 프로필 (로컬 SEO) — fetchBusinessProfile

어드민 **운영 > 비즈니스 프로필**에서 저장한 사업장 정보(이름·업종·주소·
좌표·영업시간·네이버플레이스/구글 비즈니스 프로필 URL)를 조회합니다.

```ts
import {
  fetchBusinessProfile,
  localBusinessSchema,
} from "@roottale/cms-client/server";

const business = await fetchBusinessProfile({
  apiKey: process.env.ROOTTALE_API_KEY!,
});
// 미설정이면 null. 설정돼 있으면 name, businessType, address, geo,
// openingHours, priceRange, areaServed, profiles(sameAs용 URL) 포함.

if (business) {
  const jsonLd = localBusinessSchema(business, {
    url: process.env.NEXT_PUBLIC_SITE_URL!,
  });
  // layout에 <script type="application/ld+json">으로 1회 렌더 (seo.md 참고)
}
```

## 분석 태그 — fetchAnalyticsConfig

어드민에서 등록한 외부 분석 태그(GA4, Microsoft Clarity, Meta Pixel, 네이버)
설정을 조회해 사이트에 주입합니다.

```ts
import { fetchAnalyticsConfig } from "@roottale/cms-client/server";

const config = await fetchAnalyticsConfig({
  apiKey: process.env.ROOTTALE_API_KEY!,
});
// config.tags: { provider: "ga4" | "clarity" | "meta_pixel" | "naver",
//                id: string, enabled: boolean }[]
```

`enabled: true`인 태그만 렌더링하세요. 태그 ID는 어드민에서 변경될 수
있으므로 하드코딩하지 말고 본 API로 조회하는 것을 권장합니다.
