Article Files
1 min read
Articles are Markdown files with YAML frontmatter. The file's slug is derived from its filename minus the .md extension.
Frontmatter
Frontmatter is a YAML block at the top of the file, delimited by ---. It is parsed using the gray-matter library.
Fields
| Field | Type | Required | Description |
|---|---|---|---|
title | string | Yes | The article title (must not be empty) |
description | string | No | A short summary of the article |
meta_title | string | No | Custom title for SEO |
meta_description | string | No | Custom description for SEO |
Validation
The frontmatter is validated with the following Zod schema:
typescript
z.object({
title: z.string().min(1),
description: z.string().optional(),
meta_title: z.string().optional(),
meta_description: z.string().optional(),
});
Example
A file named getting-started.md:
markdown
---
title: Getting Started
description: Learn how to set up your help center
meta_title: Getting Started | Help Center
meta_description: Step-by-step guide to setting up your help center
---
# Getting Started
Welcome to the help center. Follow these steps to get up and running.
## Prerequisites
- An active account
- API key from the dashboard
## Setup
1. Install the CLI
2. Run `opencx sync` to push your content
This produces an article with the slug getting-started.