Skip to Content
Technical GuideContent Management

Content Management

Technical documentation for Portal’s multi-source content system.

Source review: e30dd9b47, 2026-11-02. Single-page resolution uses CmsService.getPage(slug) to apply CmsResolver strategies; getPagesClient() remains the bulk/client access path. The diagram below shows client selection, not the entire per-slug strategy decision.

Architecture

CmsService.getPagesClient().getPage(slug) │ ▼ ┌─────────────────────────────────────────────┐ │ CMS_PAGES_CLIENT = ? │ ├─────────────────────────────────────────────┤ │ wordpress │ ghost │ markdown │ └──────┬────────────┬────────────┬────────────┘ │ │ │ ▼ ▼ ▼ WordPress Ghost Local MDX API API Files │ │ │ └────────────┴────────────┘ │ Fallback to MDX if not found │ ▼ CmsContentRenderer │ ┌───────────┴───────────┐ │ │ HTML string MDX component │ │ HtmlRenderer MdxRenderer

Configuration

Environment Variables

# Static pages source (default: markdown) CMS_PAGES_CLIENT=wordpress|ghost|markdown # Blog source CMS_BLOG_CLIENT=wordpress|ghost # WordPress WORDPRESS_API_URL=https://example.com WORDPRESS_API_USER=user WORDPRESS_API_PASSWORD=password # Ghost GHOST_API_URL=https://example.ghost.io GHOST_API_KEY=abc123

Static Page Slugs

When using MarkdownClient, Portal needs to know which pages exist locally (since it can’t “scan” the filesystem at runtime). This whitelist is defined in configs/defaults/content.ts:

staticPageSlugs: [ 'privacy-policy', 'terms-of-use', 'cookies-policy', 'dmca-notice', 'accessibility', 'contact-us', 'about' ]

Why needed:

  • MarkdownClient.getPages() uses this list to return all available pages
  • Without it, the client wouldn’t know which MDX files exist
  • WordPress/Ghost clients don’t need this — they query the API for all pages

CMS Clients

ClientClassFallback
WordPressClientservices/CMS/clients/WordPressClient→ MarkdownClient
GhostClientservices/CMS/clients/GhostClient→ MarkdownClient
MarkdownClientservices/CMS/clients/MarkdownClient—

All clients implement CmsClient. Client-level fallback and resolver strategy are separate layers: exact slug, longest wildcard, then * choose localOnly, remoteOnly or remoteFirst. The resolver merges defined local metadata over a remote page. An exception is not automatically treated as a missing page. F10 traces the effective path, including widget parsing/validation.

Local Content (MDX)

Directory Structure

/src/content/ ├── defaults/ ← Base content │ ├── contact-us/ │ │ ├── Markdown.mdx │ │ └── meta.json │ └── privacy-policy/ │ └── <tenant>/ ← Tenant override └── contact-us/ ├── Markdown.mdx └── meta.json

Resolution Order

  1. content/{tenant}/{slug}/ — tenant-specific
  2. content/defaults/{slug}/ — fallback

MDX Syntax

MDX = Markdown + JSX. You can import and use React components:

import { ContactWidget } from '@shared/CmsWidgets/widgets' import { Button, Stack } from '@mui/material' # Contact Us Regular markdown: **bold**, _italic_, [links](/). <Stack spacing={2}> <ContactWidget /> <Button variant="contained">Click</Button> </Stack>

Capabilities

FeatureExample
Markdown# Title, **bold**, - list
MUI components<Button>, <Stack>, <Box>
Portal widgets<ContactWidget />, <SubscribeWidget />
Local componentsimport Form from './Form.tsx'

Limitations

  • Imports must be at the top of the file
  • Hooks cannot be used directly in MDX (only inside components)
  • Interactive components need 'use client'

meta.json

Each MDX page needs a meta.json file:

{ "title": "Contact Us", "excerpt": "Get in touch with our team", "meta": { "description": "Contact us for real estate inquiries.", "keywords": ["contact", "support"] } }

How-To

Add a New Static Page

  1. Create MDX content:

    content/defaults/my-page/ ├── Markdown.mdx └── meta.json
  2. Register slug in configs/defaults/content.ts:

    staticPageSlugs: [..., 'my-page']
  3. Create route at app/(StaticPages)/my-page/page.tsx:

    import { Page40XTemplate, StaticPageTemplate } from '@templates' import { CmsContentRenderer } from '@shared/CmsContentRenderer' import CmsService from 'services/CMS' const slug = 'my-page' export async function generateMetadata() { const page = await CmsService.getPage(slug) return { title: page?.meta?.title || page?.title, description: page?.meta?.description } } export default async function StaticPage() { const page = await CmsService.getPage(slug) if (!page) return <Page40XTemplate /> return ( <StaticPageTemplate title={page.title}> <CmsContentRenderer content={page.content} /> </StaticPageTemplate> ) }

Override Page for Tenant

To override a page for a specific tenant:

  1. Create content/<tenant>/contact-us/Markdown.mdx + meta.json
  2. If WordPress doesn’t have contact-us → fallback triggers
  3. MDX loads from content/<tenant>/ instead of content/defaults/
Last updated on