feat(perf-seo): exporter에 robots 메타 옵션 추가(TDD)
This commit is contained in:
@@ -2,7 +2,7 @@ import type { Page, FormField } from '@/lib/schema/page'
|
||||
import type { AssetManager } from '@/lib/assets/assetManager'
|
||||
|
||||
export type Exported = { html: string; css: string; js: string }
|
||||
export type ExportOptions = { assetManager?: AssetManager; fontPreconnect?: boolean }
|
||||
export type ExportOptions = { assetManager?: AssetManager; fontPreconnect?: boolean; robotsMeta?: string }
|
||||
|
||||
function renderFaq(section: { props: { items: Array<{ q: string; a: string }> } }) {
|
||||
const itemsRaw: Array<{ q: string; a: string }> = Array.isArray(section.props.items) ? section.props.items : []
|
||||
@@ -251,6 +251,7 @@ function buildHead(page: Page, opts?: ExportOptions) {
|
||||
}
|
||||
const custom = page.analytics?.customHeadHtml || ''
|
||||
const preconnect = opts?.fontPreconnect !== false
|
||||
const robotsMeta = (opts?.robotsMeta && opts.robotsMeta.trim().length > 0) ? `<meta name="robots" content="${escapeHtml(opts!.robotsMeta!)}" />` : ''
|
||||
return `
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
@@ -259,6 +260,7 @@ function buildHead(page: Page, opts?: ExportOptions) {
|
||||
${preconnect ? '<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />' : ''}
|
||||
<link rel="manifest" href="/site.webmanifest" />
|
||||
<meta name="theme-color" content="${escapeHtml(page.theme.primaryColor)}" />
|
||||
${robotsMeta}
|
||||
<title>${escapeHtml(page.seo.title)}</title>
|
||||
<meta name="description" content="${escapeHtml(page.seo.description)}" />
|
||||
<meta property="og:title" content="${escapeHtml(page.seo.title)}" />
|
||||
|
||||
Reference in New Issue
Block a user