Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions fern/products/docs/pages/customization/frontmatter.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ subtitle: Set titles, add meta descriptions, and more
description: Use frontmatter to set a variety of page properties and metadata.
---

TEST and more

You can optionally use frontmatter to set each page's title, full slug override, meta description, a URL to suggest edits to the page, and its OpenGraph image. You can also use frontmatter to disable certain page elements like the table of contents and on-page feedback. For advanced styling and functionality customizations beyond frontmatter options, see [custom CSS and JavaScript](/docs/customization/custom-css-js).

You can optionally use frontmatter to set each page's title, full slug override, meta description, a URL to suggest edits to the page, and its OpenGraph image. You can also use frontmatter to disable certain page elements like the table of contents and on-page feedback. For advanced styling and functionality customizations beyond frontmatter options, see [custom CSS and JavaScript](/docs/customization/custom-css-js).

Frontmatter must be added to the top of a `.md` or `.mdx` file, before the rest of the content. Use sets of three dashes to indicate the beginning and end of your frontmatter, as shown:
Expand Down Expand Up @@ -31,13 +35,15 @@ og:title: SEO Metadata Title
The page title can be set in two ways:

1. In the page's frontmatter:

```mdx title="welcome.mdx"
---
title: Welcome to our docs
---
```

2. From the page name in docs.yml (used if no frontmatter title is set):

```yaml title="docs.yml"
title: Fern | Documentation # Site-wide title suffix
navigation:
Expand All @@ -46,6 +52,7 @@ navigation:
```

The final title will include the site-wide suffix. For example:

- With frontmatter: "Welcome to our docs - Fern | Documentation"
- Without frontmatter: "Welcome - Fern | Documentation"

Expand All @@ -68,6 +75,7 @@ For example, if you set `slug: email` in frontmatter, the page will be available
There are two ways to set a page's URL slug:

1. Using `slug` in docs.yml, which is relative to the page's location in the navigation:

<CodeBlock title='docs.yml'>
```yaml
navigation:
Expand All @@ -82,6 +90,7 @@ navigation:
</CodeBlock>

2. Using `slug` in frontmatter, which overrides everything and sets the absolute path from the root:

<CodeBlock title='email-us.mdx'>
```mdx
---
Expand All @@ -91,6 +100,7 @@ slug: email # Results in /email (ignores navigation structure)
</CodeBlock>

The key difference is:

- A slug in docs.yml is relative to the page's location in the navigation structure
- A slug in frontmatter is absolute and ignores the navigation structure completely

Expand Down Expand Up @@ -135,7 +145,9 @@ edit-this-page-url: https://github.com/your-org/docs/blob/main/content/api-refer
</ParamField>

## Table of contents

### Hide table of contents

<ParamField path="hide-toc" type="boolean" required={false} default={false}>
Controls the conditional rendering of the table of contents feature on the right-side of the page. Set to `true` to disable this feature.
</ParamField>
Expand All @@ -156,6 +168,7 @@ hide-toc: true
When the table of contents is hidden, Fern will center the contents of the page by default. To control the layout of the page, see the [layout documentation](#layout).

### Max depth

<ParamField path="max-toc-depth" type="number" required={false}>
Sets the maximum depth of the table of contents. For example, a value of `3` will only show `<h1>`, `<h2>`, and `<h3>` headings in the table of contents.
</ParamField>
Expand All @@ -174,6 +187,7 @@ max-toc-depth: 3
</Frame>

## Navigation links

<ParamField path="hide-nav-links" type="boolean" required={false} default={false}>
Controls the conditional rendering of the navigation links (previous, next) at the bottom of the page. Set to true to disable this feature.

Expand All @@ -194,6 +208,7 @@ hide-nav-links: true
</Frame>

## On-page feedback

<ParamField path="hide-feedback" type="boolean" required={false} default={false}>
Controls the conditional rendering of the on-page feedback form at the bottom of the page. Set to true to disable this feature.

Expand All @@ -214,6 +229,7 @@ hide-feedback: true
</Frame>

## Page logo

<ParamField path="logo" type="object" required={false}>
Override the site-wide logo for a page. Specify different logos for light and dark modes using absolute URLs.
</ParamField>
Expand All @@ -233,20 +249,22 @@ Currently, relative paths are _not_ supported for this field.
</Info>

## Layout

<ParamField path="layout" type="string" required={false} default="guide">
Sets the page layout. Available options:

- `overview`: A spacious, full-width layout without a table of contents. Perfect for landing pages, section overviews, and content that benefits from maximum horizontal space. Navigation sidebar remains visible.

- `guide`: The default documentation layout featuring a table of contents on the right side. Ideal for tutorials, how-to guides, and any content that benefits from easy navigation through sections.

- `reference`: A full-width layout optimized for an API or SDK reference. Removes the table of contents so you can add another column, such as code examples. Navigation sidebar remains visible.

- `page`: A distraction-free, full-screen layout that hides both the table of contents and navigation sidebar. Best for standalone content that benefits from focused reading experiences.

- `custom`: A blank canvas layout that removes all default styling constraints. Hides both the table of contents and navigation sidebar, allowing complete control over the page layout.
</ParamField>


## SEO metadata

<Note title="Looking to set metadata across the entire site?">
Expand All @@ -262,4 +280,3 @@ Currently, relative paths are _not_ supported for this field.
</ParamField>

<Markdown src="/snippets/changelog-example.mdx" />