-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocusaurus.config.ts
More file actions
289 lines (274 loc) · 9.43 KB
/
Copy pathdocusaurus.config.ts
File metadata and controls
289 lines (274 loc) · 9.43 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
import { themes as prismThemes } from 'prism-react-renderer';
import type { Config } from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import type * as PluginContentBlog from '@docusaurus/plugin-content-blog';
// 数式表示のためのRemark/Rehypeプラグイン
const math = require('remark-math');
const katex = require('rehype-katex');
// Copyright 年数: 開始年〜現在年(ビルド時評価で自動更新)。同一年なら単年表示。
const startYear = 2025;
const currentYear = new Date().getFullYear();
const copyrightYears =
currentYear > startYear ? `${startYear} - ${currentYear}` : `${startYear}`;
const config: Config = {
title: 'HKDocs',
tagline: 'My Knowledge Imprint',
favicon: 'img/favicon.ico',
future: {
// v4: true は 3.10 で fasterByDefault も有効化し @docusaurus/faster(Rspack) を要求するため、
// webpack を維持する目的で faster のみ無効化して展開(他フラグは v4 既定=true のまま)。
// Rspack/SWC への切替は v4 GA 時にまとめて実施(YAGNI)。
v4: {
removeLegacyPostBuildHeadAttribute: true,
useCssCascadeLayers: true,
siteStorageNamespacing: true,
mdx1CompatDisabledByDefault: true,
fasterByDefault: false,
},
},
markdown: {
mermaid: true,
// v4 (mdx1CompatDisabledByDefault) に完全準拠。全 .md/.mdx の <!-- --> コメントは
// {/* */} へ移行済み(truncate マーカー含む)。mdx1Compat の互換保持は不要。
hooks: {
// 3.9 で onBrokenMarkdownLinks(トップレベル)が非推奨→ここへ移設
onBrokenMarkdownLinks: 'warn',
},
},
trailingSlash: true,
url: 'https://hkdocs.com/',
baseUrl: '/',
organizationName: 'hiroaki-com',
projectName: 'hkdocs',
onBrokenLinks: 'throw',
// 国際化(i18n)設定
i18n: {
defaultLocale: 'ja',
locales: ['ja', 'en'],
localeConfigs: {
ja: {
label: '日本語',
htmlLang: 'ja-JP',
},
en: {
label: 'English',
htmlLang: 'en-US',
},
},
},
themes: ['@docusaurus/theme-mermaid'],
presets: [
[
'classic',
{
gtag: {
trackingID: 'G-NKX9CMSK0S',
anonymizeIP: true,
},
docs: {
sidebarPath: './sidebars.ts',
editUrl: 'https://github.com/hiroaki-com/hkdocs',
remarkPlugins: [math],
rehypePlugins: [katex],
showLastUpdateTime: true,
},
blog: {
blogSidebarTitle: 'All posts',
blogSidebarCount: 'ALL',
showReadingTime: true,
feedOptions: {
type: ['rss', 'atom'],
xslt: true,
},
editUrl: 'https://github.com/hiroaki-com/hkdocs',
onInlineTags: 'warn',
onInlineAuthors: 'warn',
onUntruncatedBlogPosts: 'warn',
remarkPlugins: [math],
rehypePlugins: [katex],
},
theme: {
customCss: './src/css/custom.css',
},
sitemap: {
// 更新日時シグナルを付与(changefreq/priority はGoogleがほぼ無視するため出力しない)
lastmod: 'date',
changefreq: null,
priority: null,
// 薄いページ(タグ/著者/ページネーション/検索)と検索対象外の日記を除外し、実質コンテンツへクロールを集中。
// tags/page/authors は常に /blog|/docs 配下にネストするため /**/ で ja・en 両方に効くが、
// ルート直下の /diary/・/search/ は /**/ が先頭でマッチしないため ja・en を明示的に列挙する。
ignorePatterns: [
'/**/tags/**',
'/**/authors/**',
'/**/page/**',
'/search/**',
'/en/search/**',
'/diary/**',
'/en/diary/**',
],
},
} satisfies Preset.Options,
],
],
plugins: [
[
'@docusaurus/plugin-content-blog',
{
id: 'diary', // 2つ目のブログとして'diary'を定義
routeBasePath: 'diary',
path: './diary',
blogTitle: 'Diary',
blogDescription: '体調など雑多な日常の記録',
showReadingTime: false,
authorsMapPath: '../blog/authors.yml',
blogSidebarTitle: 'All posts',
blogSidebarCount: 'ALL',
} satisfies PluginContentBlog.Options,
],
],
stylesheets: [
{
href: 'https://cdn.jsdelivr.net/npm/katex@0.16.47/dist/katex.min.css',
type: 'text/css',
integrity:
'sha384-nH0MfJ44wi1dd7w6jinlyBgljjS8EJAh2JBoRad8a3VDw2K69vfaaqm4WnR+gXtA',
crossorigin: 'anonymous',
},
{
href: 'https://fonts.googleapis.com/css2?family=Caveat:wght@700&display=swap',
rel: 'stylesheet',
},
],
themeConfig: {
colorMode: {
defaultMode: 'dark',
disableSwitch: false,
respectPrefersColorScheme: true,
},
image: 'img/hkdocs-social-card.jpg',
announcementBar: { // i18n化のため、日本語と英語を以下で定義。参照:https://docusaurus.io/blog/releases/2.4#translations
id: 'site_release_20260903',
content:
process.env.DOCUSAURUS_CURRENT_LOCALE === 'en'
? '📗 Released <a target="_blank" rel="noopener noreferrer" href="https://sqlquizbook.com/en/">SQL Quiz Book</a>, a SQL problem collection. | 🚀 June 1, 2025 ~ 🚀 Our site source code is available on <a target="_blank" rel="noopener noreferrer" href="https://github.com/hiroaki-com/hkdocs/blob/develop/README.en.md#hkdocs">GitHub (OSS)</a>.'
: '📗 SQLの問題集 <a target="_blank" rel="noopener noreferrer" href="https://sqlquizbook.com/">SQL Quiz Book</a> をリリースしました。 / 🚀 当サイトのソースコードは全て <a target="_blank" rel="noopener noreferrer" href="https://github.com/hiroaki-com/hkdocs?tab=readme-ov-file#hkdocs">GitHubで公開(OSS)</a> しております。',
backgroundColor: '#73a8e6',
textColor: '#fcf3f0',
isCloseable: true,
},
navbar: {
title: 'HKDocs',
logo: {
alt: 'Hk Docs Logo',
src: 'img/logo.svg',
},
hideOnScroll: true,
items: [
{
type: 'docSidebar',
sidebarId: 'tutorialSidebar',
position: 'left',
label: 'Tech',
},
{ to: '/blog', label: 'ブログ', position: 'left' },
{
type: 'dropdown',
label: 'その他',
position: 'left',
items: [
{ to: '/diary', label: '日記' },
{ to: '/news', label: 'ニュース' },
{ to: '/links', label: '資料集' },
{ to: '/ai-tools', label: 'AIツール集' },
{ to: '/browser-memo', label: 'ブラウザメモ' },
{ to: '/darts', label: 'Darts' },
{ to: '/profile', label: 'プロフィール' },
],
},
{
href: 'https://github.com/hiroaki-com/hkdocs',
position: 'right',
className: 'header-github-link',
'aria-label': 'GitHub repository',
},
{
href: 'https://x.com/hkdocs',
position: 'right',
className: 'header-x-link',
target: '_blank',
rel: 'noopener noreferrer',
'aria-label': 'Follow on 𝕏',
},
{
type: 'localeDropdown',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'コンテンツ',
items: [
{ label: 'Tech', to: '/docs/intro' },
{ label: 'ブログ', to: '/blog' },
{ label: '日記', to: 'diary' },
],
},
{
title: 'More',
items: [
{ label: 'ニュース', to: '/news' },
{ label: '資料集', to: '/links' },
{ label: 'AIツール集', to: '/ai-tools' },
{ label: 'ブラウザメモ', to: '/browser-memo' },
{ label: 'Darts', to: '/darts' },
{ label: 'プロフィール', to: '/profile' },
],
},
{
title: 'SNS',
items: [
{
label: '𝕏',
href: 'https://x.com/hkdocs',
props: { target: '_blank', rel: 'noopener noreferrer' },
},
{ label: 'GitHub', href: 'https://github.com/hiroaki-com/hkdocs' },
],
},
{
title: 'Legal',
items: [
{ label: 'プライバシーポリシー', to: '/legal/privacy-policy' },
{ label: '特定商取引法に基づく表記', to: '/legal/tokusho' },
],
},
],
copyright: `Copyright © ${copyrightYears} hkdocs. All Rights Reserved.<br>The code is licensed under MIT, and the content is licensed under <a href="http://creativecommons.org/licenses/by-sa/4.0/" target="_blank" rel="noopener noreferrer">CC BY-SA 4.0</a>.`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
docs: {
sidebar: {
hideable: true,
},
},
tableOfContents: {
minHeadingLevel: 2,
maxHeadingLevel: 5,
},
algolia: {
appId: 'S30V6IHD5V',
apiKey: 'adbade7d0089113887a2a706a77f72f8',
indexName: 'hkcom',
placeholder: 'サイト内検索',
contextualSearch: true,
},
} satisfies Preset.ThemeConfig,
};
export default config;