-
-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Headless: Write unit tests for virtual storage
- Loading branch information
Showing
4 changed files
with
90 additions
and
116 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,58 @@ | ||
--- | ||
title: Contentlayer | ||
index: true | ||
description: Use Next Docs with Contentlayer | ||
title: Configuration | ||
description: Learn how to use Contentlayer with Next Docs | ||
--- | ||
|
||
Next Docs has native support for Contentlayer, and provides default | ||
configuration with required MDX plugins. | ||
|
||
## Setup | ||
|
||
1. Edit your configuration. | ||
|
||
```ts title="contentlayer.config.ts" | ||
import { makeSource } from 'contentlayer/source-files'; | ||
import { defaultConfig } from 'next-docs-zeta/contentlayer/configuration'; | ||
|
||
export default makeSource(defaultConfig); | ||
``` | ||
|
||
<Callout title="Note"> | ||
Configuration file **can't** be imported from Next.js runtime. | ||
</Callout> | ||
|
||
2. Load the files with Source API. | ||
|
||
```ts | ||
import { allDocs, allMeta } from 'contentlayer/generated'; | ||
import { createContentlayerSource } from 'next-docs-zeta/contentlayer'; | ||
import { loader } from 'next-docs-zeta/source'; | ||
|
||
export const docs = loader({ | ||
baseUrl: '/docs', | ||
rootDir: 'docs', | ||
source: createContentlayerSource(allMeta, allDocs), | ||
}); | ||
``` | ||
|
||
## Pages Structure | ||
|
||
All documents should be located in `/content` or `/content/docs`. | ||
|
||
<Cards> | ||
<Card | ||
title="Pages Structure" | ||
description="Learn how to structure your pages" | ||
href="/docs/headless/page-conventions" | ||
/> | ||
</Cards> | ||
|
||
## Advanced | ||
|
||
Next Docs Zeta also adds extra functionalities to Contentlayer, making it more | ||
convenient to use and straightforward. | ||
|
||
### Adding Icons | ||
|
||
You can configure the icon handler in | ||
the [`loader`](/docs/headless/source-api#icons). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters