Skip to content
Open
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
88 changes: 44 additions & 44 deletions fern/products/docs/pages/seo/configuring-slugs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,44 @@ description: Customize URL paths in your Fern documentation site. Rename slugs f
---


By default, Fern generates the slug of a page based on the navigation structure in the `docs.yml` file.
By default, Fern generates the slug of a page based on the navigation structure in the `docs.yml` file.

<AccordionGroup>
<Accordion title="Example without tabs" defaultOpen>
```yaml docs.yml {5, 7}
instances:
- url: plantstore.docs.buildwithfern.com

navigation:
- section: Get Started
contents:
- page: Welcome
contents:
- page: Welcome
path: ./docs/pages/welcome.mdx
```

In the example above, the **Welcome** page would be hosted at `plantstore.docs.buildwithfern.com/get-started/welcome`.
In the example above, the **Welcome** page would be hosted at `plantstore.docs.buildwithfern.com/get-started/welcome`.
</Accordion>
<Accordion title="Example with tabs">
```yaml docs.yml {5, 13, 15}
instances:
- url: plantstore.docs.buildwithfern.com
tabs:

tabs:
docs:
display-name: Docs
reference:
reference:
display-name: API Reference

navigation:
- tab: docs
layout:
layout:
- section: Get Started
contents:
- page: Welcome
contents:
- page: Welcome
path: ./docs/pages/welcome.mdx
```

In the example above, the **Welcome** page would be hosted at `plantstore.docs.buildwithfern.com/docs/get-started/welcome`.
In the example above, the **Welcome** page would be hosted at `plantstore.docs.buildwithfern.com/docs/get-started/welcome`.
</Accordion>
</AccordionGroup>

Expand All @@ -56,48 +56,48 @@ You can customize these default slugs by renaming them or skipping them entirely
Set the `slug` property in `docs.yml` or in a page's frontmatter to customize the URL path.

### Modify a page or section slug
To modify the slug used for a page or section, you can set the `slug` within the `navigation` object.
To modify the slug used for a page or section, you can set the `slug` within the `navigation` object.

```yaml docs.yml {3, 6}
navigation:
- section: Get Started
slug: start
contents:
- page: Welcome
contents:
- page: Welcome
slug: intro
path: ./docs/pages/welcome.mdx
```

In the example above, the **Welcome** page would be hosted at `plantstore.docs.buildwithfern.com/start/intro`.
In the example above, the **Welcome** page would be hosted at `plantstore.docs.buildwithfern.com/start/intro`.

### Modify a tab slug

To modify the slug used for a tab, you can set the `slug` within the `tabs` object.
To modify the slug used for a tab, you can set the `slug` within the `tabs` object.

```yaml docs.yml {4}
tabs:
tabs:
docs:
display-name: Docs
slug: guides
reference:
reference:
display-name: API Reference

navigation:
- tab: docs
layout:
layout:
- section: Get Started
contents:
- page: Welcome
contents:
- page: Welcome
path: ./docs/pages/welcome.mdx
```

In the example above, the **Welcome** page would be hosted at `plantstore.docs.buildwithfern.com/guides/get-started/welcome`.
In the example above, the **Welcome** page would be hosted at `plantstore.docs.buildwithfern.com/guides/get-started/welcome`.

### Modify a landing page's slug
To modify the slug used for a landing page, you can set the `slug` within the `landing-page` object.
To modify the slug used for a landing page, you can set the `slug` within the `landing-page` object.

```yaml title="docs.yml" {4}
landing-page:
landing-page:
page: Page Title
path: path/to/landing-page.mdx
slug: /welcome
Expand Down Expand Up @@ -128,24 +128,24 @@ slug: start-up
The page is now available at `plantstore.docs.buildwithfern.com/start/start-up` instead. See [frontmatter configuration](/learn/docs/configuration/page-level-settings#slug) for more details.

### Renaming slugs for subheadings
By default, deep links to subheadings are generated by appending a `#` and the subheading title (converted to `kebab-casing-convention`) onto the page URL.
By default, deep links to subheadings are generated by appending a `#` and the subheading title (converted to `kebab-casing-convention`) onto the page URL.

```yaml docs.yml
navigation:
- section: Get Started
contents:
- page: Welcome
contents:
- page: Welcome
path: ./docs/pages/welcome.mdx
```

```markdown welcome.mdx
...

## Frequently Asked Questions
## Frequently Asked Questions
...
```

The link to this section will be available at `plantstore.docs.buildwithfern.com/get-started/welcome#frequently-asked-questions`.
The link to this section will be available at `plantstore.docs.buildwithfern.com/get-started/welcome#frequently-asked-questions`.

To rename the slug of the subheading, add the desired slug:

Expand All @@ -156,43 +156,43 @@ To rename the slug of the subheading, add the desired slug:
The link to this section will now be available at `plantstore.docs.buildwithfern.com/get-started/welcome#faqs`.

## Skipping slugs
To ignore a tab or section when generating the slug, simply indicate `skip-slug: true`.
To ignore a tab or section when generating the slug, simply indicate `skip-slug: true`.

<AccordionGroup>
<Accordion title="Example without tabs defaultOpen">
```yaml docs.yml {6}
instances:
- url: plantstore.docs.buildwithfern.com

navigation:
- section: Get Started
skip-slug: true
contents:
- page: Welcome
contents:
- page: Welcome
path: ./docs/pages/welcome.mdx
```

In the example above, the **Welcome** page would be hosted at `plantstore.docs.buildwithfern.com/welcome`.
In the example above, the **Welcome** page would be hosted at `plantstore.docs.buildwithfern.com/welcome`.
</Accordion>
<Accordion title="Example with tabs">
```yaml docs.yml {7, 15}
instances:
- url: plantstore.docs.buildwithfern.com
tabs:

tabs:
docs:
display-name: Docs
skip-slug: true
reference:
reference:
display-name: API Reference

navigation:
- tab: docs
layout:
layout:
- section: Get Started
skip-slug: true
contents:
- page: Welcome
contents:
- page: Welcome
path: ./docs/pages/welcome.mdx
```

Expand Down
Loading