Ir para o conteúdo principal
Version: 3.2.1

📦 plugin-content-pages

O plugin de páginas padrão para o Docusaurus. O modelo clássico é fornecido com este plugin com configurações padrão. This plugin provides creating pages functionality.

Installation

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.

Configuration

Campos aceitos:

NomeTypePadrãoDescrição
pathstring'src/pages'Path to data on filesystem relative to site dir. Components in this directory will be automatically converted to pages.
routeBasePathstring'/'URL route for the pages section of your site. DO NOT include a trailing slash.
includestring[]['**/*.{js,jsx,ts,tsx,md,mdx}']Os arquivos correspondentes serão incluídos e processados.
excludestring[]See example configurationNo route will be created for matching files.
mdxPageComponentstring'@theme/MDXPage'Componente usado em cada página MDX.
remarkPlugins[]any[]Remark plugins passed to MDX.
rehypePlugins[]any[]Rehype plugins passed to MDX.
beforeDefaultRemarkPluginsany[][]Custom Remark plugins passed to MDX before the default Docusaurus Remark plugins.
beforeDefaultRehypePluginsany[][]Custom Rehype plugins passed to MDX before the default Docusaurus Rehype plugins.

Example configuration

Você pode configurar este plugin através das opções de predefinição ou opções do plugin.

tip

A maioria dos usuários do Docusaurus configura este plugin através das configurações de predefinição.

Se você usar uma predefinição, configure este plugin através do opções de predefinição:

docusaurus.config.js
module.exports = {
presets: [
[
'@docusaurus/preset-classic',
{
pages: {
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('./my-remark-plugin')],
rehypePlugins: [],
beforeDefaultRemarkPlugins: [],
beforeDefaultRehypePlugins: [],
},
},
],
],
};

Markdown front matter

Markdown pages can use the following Markdown front matter metadata fields, enclosed by a line --- on either side.

Campos aceitos:

NomeTypePadrãoDescrição
titlestringMarkdown titleThe blog post title.
descriptionstringThe first line of Markdown contentThe description of your page, which will become the <meta name="description" content="..."/> and <meta property="og:description" content="..."/> in <head>, used by search engines.
keywordsstring[]undefinedKeywords meta tag, which will become the <meta name="keywords" content="keyword1,keyword2,..."/> in <head>, used by search engines.
imagestringundefinedCover or thumbnail image that will be used as the <meta property="og:image" content="..."/> in the <head>, enhancing link previews on social media and messaging platforms.
wrapperClassNamestringClass name to be added to the wrapper element to allow targeting specific page content.
hide_table_of_contentsbooleanfalseWhether to hide the table of contents to the right.
draftbooleanfalseDraft pages will only be available during development.
unlistedbooleanfalseUnlisted pages will be available in both development and production. They will be "hidden" in production, not indexed, excluded from sitemaps, and can only be accessed by users having a direct link.

Exemplo:

---
title: Markdown Page
description: Markdown page SEO description
wrapperClassName: markdown-page
hide_table_of_contents: false
draft: true
---

Markdown page content

i18n

Read the i18n introduction first.

Translation files location

  • Base path: website/i18n/[locale]/docusaurus-plugin-content-pages
  • Multi-instance path: website/i18n/[locale]/docusaurus-plugin-content-pages-[pluginId]
  • JSON files: extracted with docusaurus write-translations
  • Markdown files: website/i18n/[locale]/docusaurus-plugin-content-pages

Example file-system structure

website/i18n/[locale]/docusaurus-plugin-content-pages

# translations for website/src/pages
├── first-markdown-page.md
└── second-markdown-page.md