๋ฉ”์ธ ์ปจํ…์ธ ๋กœ ์ด๋™
Version: 2.0.0-beta.9

๐Ÿ“ฆ plugin-content-pages

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

์„ค์น˜

npm install --save @docusaurus/plugin-content-pages
tip

@docusaurus/preset-classic์„ ์„ค์น˜ํ•œ ๊ฒฝ์šฐ์—๋Š” ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ๋”ฐ๋กœ ์„ค์น˜ํ•  ํ•„์š”๋Š” ์—†์Šต๋‹ˆ๋‹ค.

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

์„ค์ •

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

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

์„ค์ • ์˜ˆ์‹œ

๋‹ค์Œ์€ ์˜ค๋ธŒ์ ํŠธ ์„ค์ • ์˜ˆ์‹œ์ž…๋‹ˆ๋‹ค.

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

tip

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

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: [],
};

ํ”„๋ฆฌ์…‹ ์˜ต์…˜

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

docusaurus.config.js
module.exports = {
presets: [
[
'@docusaurus/preset-classic',
{
pages: {
path: 'src/pages',
// ... configuration object here
},
},
],
],
};

ํ”Œ๋Ÿฌ๊ทธ์ธ ์˜ต์…˜

๋…๋ฆฝ์ ์œผ๋กœ ์‹คํ–‰๋˜๋Š” ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ์—๋Š” ํ”Œ๋Ÿฌ๊ทธ์ธ์— ๋Œ€ํ•œ ์˜ต์…˜์„ ์ง์ ‘ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

docusaurus.config.js
module.exports = {
plugins: [
[
'@docusaurus/plugin-content-pages',
{
path: 'src/pages',
// ... configuration object here
},
],
],
};

i18n

i18n ์†Œ๊ฐœ ๋ฌธ์„œ๋ฅผ ๋จผ์ € ํ™•์ธํ•ด์ฃผ์„ธ์š”.

๋ฒˆ์—ญ ํŒŒ์ผ ์œ„์น˜

  • ๊ธฐ๋ณธ ๊ฒฝ๋กœ: website/i18n/<locale>/docusaurus-plugin-content-pages
  • ๋ฉ€ํ‹ฐ ์ธ์Šคํ„ด์Šค ๊ฒฝ๋กœ: website/i18n/<locale>/docusaurus-plugin-content-pages-<pluginId>
  • JSON ํŒŒ์ผ: docusaurus write-translations ๋ช…๋ น ์‹คํ–‰ ํ›„ ๋งŒ๋“ค์–ด์ง„ ํŒŒ์ผ
  • ๋งˆํฌ๋‹ค์šด ํŒŒ์ผ: website/i18n/<locale>/docusaurus-plugin-content-pages

ํŒŒ์ผ ์‹œ์Šคํ…œ ๊ตฌ์กฐ ์˜ˆ

website/i18n/<locale>/docusaurus-plugin-content-pages
โ”‚
โ”‚ # translations for website/src/pages
โ”œโ”€โ”€ first-markdown-page.md
โ””โ”€โ”€ second-markdown-page.md