-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocusaurus.config.ts
More file actions
295 lines (272 loc) · 9 KB
/
docusaurus.config.ts
File metadata and controls
295 lines (272 loc) · 9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import autoLanguagePlugin from './src/remark/auto-language-plugin';
import replacePlaceholdersPlugin from './src/remark/replace-placeholders';
import anchorMappingPlugin from './src/remark/anchor-mapping';
import githubAdmonitionPlugin from './src/remark/github-admonition';
import styleJsxCleanupPlugin from './src/remark/style-jsx-cleanup';
import methodClassPlugin from './src/remark/method-class';
import stripPandocAttrsPlugin from './src/remark/strip-pandoc-attrs';
import versions from './versions.json';
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
// `versions.json`을 단일 출처로 사용해 새 버전 출시 시 한 곳만 갱신하면 footer/navbar/
// lastVersion/path/sidebarPath가 자동으로 따라가도록 한다. master는 임시 버전이므로
// 안정 버전 후보에서 제외하고, 첫 번째 항목을 LATEST_STABLE로 사용한다.
const LATEST_STABLE = versions.find((v) => v !== 'master') ?? versions[0];
const DEFAULT_LOCALE = 'ko';
const LOCALES = ['en', 'ko', 'ja'];
const LOCALIZED_ROUTE_PREFIXES = LOCALES.filter((locale) => locale !== DEFAULT_LOCALE);
const DOCS_LATEST_REDIRECT_SCRIPT = `
(function () {
var latest = ${JSON.stringify(LATEST_STABLE)};
var versions = ${JSON.stringify(versions)};
var locales = ${JSON.stringify(LOCALIZED_ROUTE_PREFIXES)};
var parts = window.location.pathname.replace(/^\\/+|\\/+$/g, '').split('/').filter(Boolean);
var locale = locales.indexOf(parts[0]) >= 0 ? parts.shift() : '';
if (parts[0] !== 'docs') return;
parts.shift();
if (parts.length === 0) {
window.location.replace('/' + (locale ? locale + '/' : '') + 'docs/' + latest + window.location.search + window.location.hash);
return;
}
if (versions.indexOf(parts[0]) >= 0) return;
window.location.replace('/' + (locale ? locale + '/' : '') + 'docs/' + latest + '/' + parts.join('/') + window.location.search + window.location.hash);
})();
`;
const config: Config = {
title: 'Laravel',
tagline: '라라벨',
favicon: 'img/favicon.png',
// Set the production url of your site here
url: 'https://laravel.chanhyung.kim',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/',
headTags: [
{
tagName: 'script',
attributes: {},
innerHTML: DOCS_LATEST_REDIRECT_SCRIPT,
},
],
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'letsescape', // Usually your GitHub org/user name.
projectName: 'laravel-docs', // Usually your repo name.
onBrokenLinks: 'warn',
// 실제 브라우저 앵커 동작은 별도 검증 스크립트와 e2e에서 확인한다.
onBrokenAnchors: 'ignore',
// Docusaurus 확장 문법({#id}, admonitions 등)과 CommonMark 자동 감지를 위해 detect 유지.
// Blade/Livewire 특수문자는 Prism 코드 블록 내에서 토큰화되므로 실제 렌더링에 영향 없음.
markdown: {
format: 'detect',
hooks: {
onBrokenMarkdownLinks: 'warn',
},
mdx1Compat: {
comments: false,
admonitions: false,
headingIds: false,
},
},
// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: DEFAULT_LOCALE,
locales: LOCALES,
localeConfigs: {
en: {
htmlLang: 'en',
label: 'English',
},
ko: {
htmlLang: 'ko',
label: '한국어',
},
ja: {
htmlLang: 'ja',
label: '日本語',
},
},
},
// 테마 설정
themes: [],
plugins: [
[
'@docusaurus/plugin-content-docs',
{
id: 'default',
path: `versioned_docs/version-${LATEST_STABLE}`,
routeBasePath: 'docs',
sidebarPath: `./versioned_sidebars/version-${LATEST_STABLE}-sidebars.json`,
// 버전 관리 설정
includeCurrentVersion: false,
lastVersion: LATEST_STABLE,
versions: Object.fromEntries(
versions.map((v) => [v, {label: v, path: v}]),
),
// 기타 설정
editUrl: 'https://github.com/letsescape/laravel-docs/tree/develop/',
beforeDefaultRemarkPlugins: [
anchorMappingPlugin,
],
remarkPlugins: [
styleJsxCleanupPlugin,
githubAdmonitionPlugin,
methodClassPlugin,
stripPandocAttrsPlugin,
replacePlaceholdersPlugin,
autoLanguagePlugin,
],
// origin/ 하위는 Laravel 원본 보관용. `{{version}}` 등 서버사이드 템플릿이
// 남아있어 문서로 렌더링하면 링크가 깨지므로 사이트에서 제외.
// documentation.md는 사이드바 시드이며 문서 페이지로 노출할 필요가 없다.
// readme.md는 installation.md의 `slug: /`와 같은 버전 루트 경로를 만들어
// `/docs/<version>/` 중복 라우트 경고를 내므로 사이트에서 제외.
exclude: [
'**/origin/**',
'**/documentation.md',
'**/readme.md',
// Docusaurus 기본 exclude 유지
'**/_*.{js,jsx,ts,tsx,md,mdx}',
'**/_*/**',
'**/*.test.{js,jsx,ts,tsx}',
'**/__tests__/**',
],
},
],
],
presets: [
[
'classic',
{
docs: false, // 플러그인으로 대체
blog: false,
sitemap: {
lastmod: 'date',
changefreq: null,
priority: null,
filename: 'sitemap.xml',
},
gtag: {
trackingID: 'G-P3YFWCWEBP',
anonymizeIP: true,
},
googleTagManager: {
containerId: 'GTM-MDN4L5LV',
},
theme: {
customCss: './src/css/custom.css',
},
} satisfies Preset.Options,
],
],
themeConfig: {
// OG 이미지 사이트 기본값 (메인 페이지에서는 별도 이미지로 오버라이드)
image: 'img/laravel-docs.png',
// 다크 모드 설정
colorMode: {
defaultMode: 'dark', // 기본 모드를 다크로 설정
disableSwitch: false, // 테마 전환 스위치 활성화
respectPrefersColorScheme: true, // 사용자 시스템 설정 존중
},
// SEO 메타데이터 (언어 중립 항목만, 로케일별 메타데이터는 src/theme/Root.tsx에서 처리)
// og:image/twitter:image는 themeConfig.image가 기본값으로 제공하며, 페이지별로 Head에서 오버라이드
metadata: [
{property: 'og:type', content: 'website'},
{name: 'twitter:card', content: 'summary_large_image'},
],
// Algolia DocSearch 설정
algolia: {
// The application ID provided by Algolia
appId: 'I09J6O9PPB',
// Public API key: it is safe to commit it
apiKey: '9490c4a274419bf3d76145ab91c89b14',
indexName: 'laravel-chanhyung',
// 로케일 및 버전별 검색 필터링
contextualSearch: true,
// 검색 결과 페이지 경로 설정
searchPagePath: 'search',
// 사용자 검색 분석 기능 활성화
insights: true,
},
navbar: {
logo: {
alt: 'Laravel Logo',
src: 'img/title_large.svg',
srcDark: 'img/title_large.svg',
className: 'navbar-logo',
},
items: [
{
to: `/docs/${LATEST_STABLE}`,
position: 'left',
label: 'Docs',
},
{
type: 'docsVersionDropdown',
position: 'right',
dropdownItemsAfter: [],
dropdownActiveClassDisabled: true,
},
{
type: 'localeDropdown',
position: 'right',
},
],
},
footer: {
style: 'dark',
logo: {
alt: 'Laravel Logo',
src: 'img/title_large.svg',
href: '/',
className: 'footer-logo',
},
links: [
{
title: 'Docs',
items: [
{
label: 'Getting Started',
to: `/docs/${LATEST_STABLE}`,
},
{
label: 'Architecture Concepts',
to: `/docs/${LATEST_STABLE}/container`,
},
],
},
{
title: 'Community',
items: [
{
label: 'Laravel Korea',
href: 'https://laravel.kr',
},
],
},
],
copyright: `Copyright © 2025 kimchanhyung98. Built with Docusaurus.`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
additionalLanguages: [
'php',
'bash',
'ini',
'nginx',
'docker',
'apacheconf',
'json',
'yaml',
'sql',
'markup',
],
},
} satisfies Preset.ThemeConfig,
};
export default config;