Privacy and Terms Configuration
Configure legal page visibility, entry mapping, and custom legal copy.
The legal module renders Privacy, Terms, and Behavior (community guidelines) pages. Visibility is controlled by config; content can come from Content Collections defaults or custom functions.
Scope and Entry Points
src/app/(landing-page)/[locale]/(cms)/legal/[...path]/page.tsx
src/config/custom-common.ts
src/config/custom-legal.ts
content/legal
| File | Purpose |
|---|---|
legal/[...path]/page.tsx | Legal route and config.ui.legal.enabled check |
custom-common.ts | Footer legal link assembly from allowMap |
custom-legal.ts | Custom legal copy toggles and content functions |
content/legal | Content Collections legal MDX source |
Fast Edit Path
Use config.ui.legal.enabled and allowMap to control visibility.
Set config.i18n.locales.*.footerConfig.legal for footer labels.
For custom copy, enable useLegalCustom* in custom-legal.ts and provide content functions.
// src/config/index.ts
ui: {
legal: {
enabled: true,
allowMap: [
{ type: "privacy", enabled: true },
{ type: "terms", enabled: true },
{ type: "behavior", enabled: false },
],
},
}// src/config/index.ts
i18n: {
locales: {
zh: {
footerConfig: {
legal: {
privacy: "隐私政策",
terms: "服务条款",
behavior: "社区规范",
},
},
},
en: {
footerConfig: {
legal: {
privacy: "Privacy",
terms: "Terms",
behavior: "Community",
},
},
},
},
}Default vs Custom Content
By default, legal pages use Content Collections template content. To fully override:
// src/config/custom-legal.ts
export const useLegalCustomPrivacyData = true;
export const useLegalCustomTermsData = false;
export const useLegalCustomBehaviorData = false;
export const legalI18nPrivacyContent: Record<string, (appInfo: AppInfo) => string> = {
zh: (appInfo) => `# 隐私政策\n\n...your Markdown...`,
en: (appInfo) => `# Privacy Policy\n\n...`,
};Content Functions
Content functions receive appInfo and return Markdown strings, useful for inserting app name and other dynamic text.
Config Reference
| Config | Location | Default | Effect |
|---|---|---|---|
config.ui.legal.enabled | src/config/index.ts | true | Controls /legal/** access |
config.ui.legal.allowMap | src/config/index.ts | privacy/terms on, behavior off | Footer links and accessible sub-pages |
config.i18n.locales.*.footerConfig.legal | src/config/index.ts | Privacy/Terms/Community | Footer legal group labels |
useLegalCustom* and legalI18n*Content | src/config/custom-legal.ts | false / empty | Whether to use custom Markdown content |
Related Docs
- Docs Configuration — Docs and CMS toggles
- Basic Configuration — Brand and footer config