website/versioned_docs/version-2.x/api/plugins/plugin-content-pages.mdx
import APITable from '@site/src/components/APITable';
The default pages plugin for Docusaurus. The classic template ships with this plugin with default configurations. This plugin provides creating pages functionality.
npm install --save @docusaurus/plugin-content-pages
:::tip
If you use the preset @docusaurus/preset-classic, you don't need to install this plugin as a dependency.
You can configure this plugin through the preset options.
:::
Accepted fields:
<APITable>
| Name | Type | Default | Description |
|---|---|---|---|
path | string | 'src/pages' | Path to data on filesystem relative to site dir. Components in this directory will be automatically converted to pages. |
routeBasePath | string | '/' | URL route for the pages section of your site. DO NOT include a trailing slash. |
include | string[] | ['**/*.{js,jsx,ts,tsx,md,mdx}'] | Matching files will be included and processed. |
exclude | string[] | See example configuration | No route will be created for matching files. |
mdxPageComponent | string | '@theme/MDXPage' | Component used by each MDX page. |
remarkPlugins | [] | any[] | Remark plugins passed to MDX. |
rehypePlugins | [] | any[] | Rehype plugins passed to MDX. |
beforeDefaultRemarkPlugins | any[] | [] | Custom Remark plugins passed to MDX before the default Docusaurus Remark plugins. |
beforeDefaultRehypePlugins | any[] | [] | Custom Rehype plugins passed to MDX before the default Docusaurus Rehype plugins. |
</APITable>
You can configure this plugin through preset options or plugin options.
:::tip
Most Docusaurus users configure this plugin through the preset options.
:::
// Preset Options: pages
// Plugin Options: @docusaurus/plugin-content-pages
const config = {
path: 'src/pages',
routeBasePath: '',
include: ['**/*.{js,jsx,ts,tsx,md,mdx}'],
exclude: [
'**/_*.{js,jsx,ts,tsx,md,mdx}',
'**/_*/**',
'**/*.test.{js,jsx,ts,tsx}',
'**/__tests__/**',
],
mdxPageComponent: '@theme/MDXPage',
remarkPlugins: [require('remark-math')],
rehypePlugins: [],
beforeDefaultRemarkPlugins: [],
beforeDefaultRehypePlugins: [],
};
Read the i18n introduction first.
website/i18n/[locale]/docusaurus-plugin-content-pageswebsite/i18n/[locale]/docusaurus-plugin-content-pages-[pluginId]docusaurus write-translationswebsite/i18n/[locale]/docusaurus-plugin-content-pageswebsite/i18n/[locale]/docusaurus-plugin-content-pages
ā
ā # translations for website/src/pages
āāā first-markdown-page.md
āāā second-markdown-page.md