Skip to content

Commit 9018fdc

Browse files
Merge pull request #3 from letsescape/feature/versioning
문서, 사이드바 개선 및 설정 수정
2 parents dffa588 + 97390de commit 9018fdc

File tree

518 files changed

+275810
-482
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

518 files changed

+275810
-482
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Deploy to GitHub Pages
33
on:
44
push:
55
branches:
6-
- feature/init
6+
- main
77
# 특정 파일이 변경되었을 때만 실행하도록 설정할 수도 있습니다
88
# paths:
99
# - docs/**

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
index.md

docusaurus.config.ts

Lines changed: 75 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import type * as Preset from '@docusaurus/preset-classic';
55
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
66

77
const config: Config = {
8-
title: 'Laravel 한국어 문서',
9-
tagline: 'PHP 웹 애플리케이션 프레임워크',
10-
favicon: 'img/favicon.ico',
8+
title: 'Laravel',
9+
tagline: 'PHP 웹 애플리케이션 프레임워크 라라벨의 모든 것을 한글로 만나보세요',
10+
favicon: 'img/favicon.png',
1111

1212
// Set the production url of your site here
1313
url: 'https://laravel.chanhyung.kim',
@@ -37,41 +37,45 @@ const config: Config = {
3737
// may want to replace "en" with "zh-Hans".
3838
i18n: {
3939
defaultLocale: 'ko',
40-
locales: ['ko', 'en'],
40+
locales: ['ko'],
41+
// locales: ['ko', 'en'],
4142
},
4243

43-
themes: [
44-
[
45-
require.resolve("@easyops-cn/docusaurus-search-local"),
46-
{
47-
hashed: true,
48-
language: ["en", "ko"],
49-
highlightSearchTermsOnTargetPage: true,
50-
explicitSearchResultPath: true,
51-
},
52-
],
53-
],
44+
// 테마 설정
45+
themes: [],
5446

5547
plugins: [
5648
[
5749
'@docusaurus/plugin-content-docs',
5850
{
5951
id: 'default',
60-
path: 'docs',
52+
path: 'versioned_docs/version-12.x',
6153
routeBasePath: 'docs',
62-
sidebarPath: './sidebars.ts',
54+
sidebarPath: './versioned_sidebars/version-12.x-sidebars.json',
6355
// 버전 관리 설정
64-
includeCurrentVersion: true,
65-
lastVersion: 'current',
56+
includeCurrentVersion: false,
57+
lastVersion: '12.x',
6658
versions: {
67-
current: {
59+
'12.x': {
6860
label: '12.x',
69-
path: '',
61+
path: '12.x',
7062
},
7163
'11.x': {
7264
label: '11.x',
7365
path: '11.x',
7466
},
67+
'10.x': {
68+
label: '10.x',
69+
path: '10.x',
70+
},
71+
'9.x': {
72+
label: '9.x',
73+
path: '9.x',
74+
},
75+
'8.x': {
76+
label: '8.x',
77+
path: '8.x',
78+
},
7579
},
7680
// 기타 설정
7781
editUrl: 'https://github.com/letsescape/laravel-docs-web/tree/main/',
@@ -94,18 +98,53 @@ const config: Config = {
9498

9599
themeConfig: {
96100
// Replace with your project's social card
97-
image: 'img/laravel-social-card.jpg',
101+
image: 'img/logo.png',
102+
103+
// 다크 모드 설정
104+
colorMode: {
105+
defaultMode: 'dark', // 기본 모드를 다크로 설정
106+
disableSwitch: false, // 테마 전환 스위치 활성화
107+
respectPrefersColorScheme: true, // 사용자 시스템 설정 존중
108+
},
109+
110+
// SEO 메타데이터
111+
metadata: [
112+
{name: 'keywords', content: '라라벨, Laravel, PHP 프레임워크, 웹 개발, 한글 문서, 튜토리얼, 시작하기'},
113+
{name: 'description', content: '라라벨 프레임워크의 설치 방법, 기본 사용법, 주요 기능들을 한글로 쉽게 배우고 시작하세요.'},
114+
{property: 'og:type', content: 'website'},
115+
{property: 'og:title', content: '라라벨 한국어 문서 - PHP 웹 프레임워크'},
116+
{property: 'og:description', content: '라라벨 프레임워크의 설치 방법, 기본 사용법, 주요 기능들을 한글로 쉽게 배우고 시작하세요.'},
117+
{property: 'og:image', content: 'https://laravel.chanhyung.kim/img/logo.png'},
118+
{name: 'twitter:card', content: 'summary_large_image'},
119+
{name: 'twitter:title', content: '라라벨 한국어 문서 - PHP 웹 프레임워크'},
120+
{name: 'twitter:description', content: '라라벨 프레임워크의 설치 방법, 기본 사용법, 주요 기능들을 한글로 쉽게 배우고 시작하세요.'},
121+
{name: 'twitter:image', content: 'https://laravel.chanhyung.kim/img/logo.png'},
122+
],
123+
124+
// Algolia DocSearch 설정
125+
algolia: {
126+
// The application ID provided by Algolia
127+
appId: 'P3AV656TKT',
128+
// Public API key: it is safe to commit it
129+
apiKey: '36cb770af37e1af6373a80778092f985',
130+
indexName: 'laravel-chanhyung',
131+
// 검색 결과 페이지 경로 설정
132+
searchPagePath: 'search',
133+
// 사용자 검색 분석 기능 활성화
134+
insights: true,
135+
},
98136

99137
navbar: {
100-
title: 'Laravel 한국어 문서',
138+
title: null,
101139
logo: {
102140
alt: 'Laravel Logo',
103-
src: 'img/logo.svg',
141+
src: 'img/title_large.svg',
142+
srcDark: 'img/title_large.svg',
143+
className: 'navbar-logo',
104144
},
105145
items: [
106146
{
107-
type: 'docSidebar',
108-
sidebarId: 'tutorialSidebar',
147+
to: '/docs/12.x',
109148
position: 'left',
110149
label: '문서',
111150
},
@@ -119,26 +158,28 @@ const config: Config = {
119158
type: 'localeDropdown',
120159
position: 'right',
121160
},
122-
{
123-
href: 'https://github.com/letsescape/laravel-docs-web',
124-
label: 'GitHub',
125-
position: 'right',
126-
},
161+
127162
],
128163
},
129164
footer: {
130165
style: 'dark',
166+
logo: {
167+
alt: 'Laravel Logo',
168+
src: 'img/title_large.svg',
169+
href: '/',
170+
className: 'footer-logo',
171+
},
131172
links: [
132173
{
133174
title: '문서',
134175
items: [
135176
{
136177
label: '시작하기',
137-
to: '/docs/intro',
178+
to: '/docs/12.x/intro',
138179
},
139180
{
140181
label: '아키텍처 개념',
141-
to: '/docs/architecture/container',
182+
to: '/docs/12.x/architecture/container',
142183
},
143184
],
144185
},
@@ -161,7 +202,7 @@ const config: Config = {
161202
],
162203
},
163204
],
164-
copyright: `Copyright © ${new Date().getFullYear()} Laravel 한국어 문서. Built with Docusaurus.`,
205+
copyright: `Copyright © 2025 kimchanhyung98. Built with Docusaurus.`,
165206
},
166207
prism: {
167208
theme: prismThemes.github,

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"serve": "docusaurus serve",
1414
"write-translations": "docusaurus write-translations",
1515
"write-heading-ids": "docusaurus write-heading-ids",
16-
"typecheck": "tsc"
16+
"typecheck": "tsc",
17+
"generate-sidebars": "node scripts/generate-sidebars.js"
1718
},
1819
"repository": {
1920
"type": "git",

scripts/generate-sidebars.js

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/**
2+
* Script to generate sidebar files for each version based on origin/documentation.md files
3+
*/
4+
const fs = require('fs');
5+
const path = require('path');
6+
7+
// Versions to process
8+
const versions = ['8.x', '9.x', '10.x', '11.x', '12.x'];
9+
10+
// Function to parse documentation.md and create sidebar structure
11+
function parseSidebar(docContent, version) {
12+
const lines = docContent.split('\n');
13+
const sidebar = {
14+
tutorialSidebar: []
15+
};
16+
17+
let currentCategory = null;
18+
19+
for (const line of lines) {
20+
// Match main category
21+
const categoryMatch = line.match(/^- ## (.+)$/);
22+
if (categoryMatch) {
23+
currentCategory = {
24+
type: 'category',
25+
label: categoryMatch[1],
26+
collapsed: true,
27+
items: []
28+
};
29+
sidebar.tutorialSidebar.push(currentCategory);
30+
continue;
31+
}
32+
33+
// Match items within a category
34+
const itemMatch = line.match(/^\s+- \[(.+)\]\(\/docs\/\{\{version\}\}\/(.+)\)$/);
35+
if (itemMatch && currentCategory) {
36+
const itemLabel = itemMatch[1];
37+
let itemPath = itemMatch[2];
38+
39+
// Remove any anchor links from the path (e.g., 'starter-kits#laravel-breeze' -> 'starter-kits')
40+
if (itemPath.includes('#')) {
41+
itemPath = itemPath.split('#')[0];
42+
}
43+
44+
currentCategory.items.push(itemPath);
45+
continue;
46+
}
47+
48+
// Match API Documentation link (outside of any category)
49+
const apiDocsMatch = line.match(/^- \[API Documentation\]\((.+)\)$/);
50+
if (apiDocsMatch) {
51+
let apiUrl = apiDocsMatch[1];
52+
// If URL contains a version placeholder, replace it with the actual version
53+
if (apiUrl.includes('{{version}}')) {
54+
apiUrl = apiUrl.replace('{{version}}', version);
55+
}
56+
57+
// Add API Documentation as a link item
58+
sidebar.tutorialSidebar.push({
59+
type: 'link',
60+
label: 'API Documentation',
61+
href: apiUrl
62+
});
63+
}
64+
}
65+
66+
return sidebar;
67+
}
68+
69+
// Process each version
70+
versions.forEach(version => {
71+
const docPath = path.join(__dirname, '..', 'versioned_docs', `version-${version}`, 'origin', 'documentation.md');
72+
const sidebarOutputPath = path.join(__dirname, '..', 'versioned_sidebars', `version-${version}-sidebars.json`);
73+
74+
// Create directory if it doesn't exist
75+
const sidebarDir = path.dirname(sidebarOutputPath);
76+
if (!fs.existsSync(sidebarDir)) {
77+
fs.mkdirSync(sidebarDir, { recursive: true });
78+
}
79+
80+
try {
81+
if (fs.existsSync(docPath)) {
82+
const docContent = fs.readFileSync(docPath, 'utf8');
83+
const sidebar = parseSidebar(docContent, version);
84+
85+
// Set first category to be expanded by default
86+
if (sidebar.tutorialSidebar.length > 0) {
87+
sidebar.tutorialSidebar[1].collapsed = false;
88+
}
89+
90+
fs.writeFileSync(sidebarOutputPath, JSON.stringify(sidebar, null, 2));
91+
console.log(`Generated sidebar for version ${version}`);
92+
} else {
93+
console.warn(`Documentation file not found for version ${version}`);
94+
}
95+
} catch (error) {
96+
console.error(`Error processing version ${version}:`, error);
97+
}
98+
});
99+
100+
console.log('Sidebar generation complete!');

0 commit comments

Comments
 (0)