๋ฉ”์ธ ์ปจํ…์ธ ๋กœ ์ด๋™
๋ฒ„์ „: 2.x

๐Ÿ“ฆ plugin-content-pages

๋„ํ์‚ฌ์šฐ๋ฃจ์Šค์˜ ๊ธฐ๋ณธ ํŽ˜์ด์ง€ ํ”Œ๋Ÿฌ๊ทธ์ธ์ž…๋‹ˆ๋‹ค. ํด๋ž˜์‹ ํ…œํ”Œ๋ฆฟ์—๋Š” ๊ธฐ๋ณธ ์„ค์ •์œผ๋กœ ํ”Œ๋Ÿฌ๊ทธ์ธ์ด ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. This plugin provides creating pages functionality.

Installationโ€‹

npm install --save @docusaurus/plugin-content-pages
ํŒ

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โ€‹

์„ค์ •ํ•  ์ˆ˜ ์žˆ๋Š” ํ•„๋“œ

์˜ต์…˜๋ช…ํƒ€์ž…๊ธฐ๋ณธ๊ฐ’์„ค๋ช…
pathstring'src/pages'์‚ฌ์ด๋“œ ๋””๋ ‰ํ† ๋ฆฌ์— ์ƒ๋Œ€์ ์ธ ํŒŒ์ผ ์‹œ์Šคํ…œ์˜ ๋ฐ์ดํ„ฐ ๊ฒฝ๋กœ์ž…๋‹ˆ๋‹ค. ๋””๋ ‰ํ† ๋ฆฌ ๋‚ด ์ปดํฌ๋„ŒํŠธ๋Š” ์ž๋™์œผ๋กœ ํŽ˜์ด์ง€๋กœ ๋ณ€ํ™˜๋ฉ๋‹ˆ๋‹ค.
routeBasePathstring'/'์‚ฌ์ดํŠธ ํŽ˜์ด์ง€ ์„น์…˜์— ๋Œ€ํ•œ URL ๋ผ์šฐํŠธ DO NOT include a trailing slash.
includestring[]['**/*.{js,jsx,ts,tsx,md,mdx}']์ผ์น˜ํ•˜๋Š” ํŒŒ์ผ์ด ํฌํ•จ๋˜์–ด ์ฒ˜๋ฆฌ๋ฉ๋‹ˆ๋‹ค.
excludestring[]See example configuration์ผ์น˜ํ•˜๋Š” ํŒŒ์ผ์— ๋Œ€ํ•œ ๋ผ์šฐํŠธ๊ฐ€ ์ƒ์„ฑ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
mdxPageComponentstring'@theme/MDXPage'๊ฐ MDX ํŽ˜์ด์ง€์—์„œ ์‚ฌ์šฉํ•˜๋Š” ์ปดํฌ๋„ŒํŠธ
remarkPlugins[]any[]MDX์— ์ „๋‹ฌ๋œ Remark ํ”Œ๋Ÿฌ๊ทธ์ธ
rehypePlugins[]any[]MDX์— ์ „๋‹ฌ๋œ Rehype ํ”Œ๋Ÿฌ๊ทธ์ธ
beforeDefaultRemarkPluginsany[][]๊ธฐ๋ณธ ๋„ํ์‚ฌ์šฐ๋ฃจ์Šค Remark ํ”Œ๋Ÿฌ๊ทธ์ธ๋ณด๋‹ค ๋จผ์ € MDX์— ์ „๋‹ฌ๋œ ์‚ฌ์šฉ์ž ์ง€์ • Remark ํ”Œ๋Ÿฌ๊ทธ์ธ
beforeDefaultRehypePluginsany[][]๊ธฐ๋ณธ ๋„ํ์‚ฌ์šฐ๋ฃจ์Šค Rehype ํ”Œ๋Ÿฌ๊ทธ์ธ๋ณด๋‹ค ๋จผ์ € MDX์— ์ „๋‹ฌ๋œ ์‚ฌ์šฉ์ž ์ง€์ • Rehype ํ”Œ๋Ÿฌ๊ทธ์ธ

Example configurationโ€‹

ํ”„๋ฆฌ์…‹ ์˜ต์…˜์ด๋‚˜ ํ”Œ๋Ÿฌ๊ทธ์ธ ์˜ต์…˜์—์„œ ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํŒ

๋Œ€๋ถ€๋ถ„์˜ ๋„ํ์‚ฌ์šฐ๋ฃจ์Šค ์‚ฌ์šฉ์ž๋Š” ํ”„๋ฆฌ์…‹ ์˜ต์…˜์„ ์‚ฌ์šฉํ•ด ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

ํ”„๋ฆฌ์…‹์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ ํ”„๋ฆฌ์…‹ ์˜ต์…˜๋ฅผ ํ†ตํ•ด ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ๊ตฌ์„ฑํ•ฉ๋‹ˆ๋‹ค.

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('remark-math')],
rehypePlugins: [],
beforeDefaultRemarkPlugins: [],
beforeDefaultRehypePlugins: [],
},
},
],
],
};

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