-
Notifications
You must be signed in to change notification settings - Fork 175
Expand file tree
/
Copy pathdoc-kit.config.mjs
More file actions
60 lines (54 loc) · 1.96 KB
/
Copy pathdoc-kit.config.mjs
File metadata and controls
60 lines (54 loc) · 1.96 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
import { join } from 'node:path';
// The full origin (scheme included) lives here, and only here, so `baseURL`
// below never has to guess the protocol. Local builds are served over plain
// HTTP (see CONTRIBUTING.md), previews and production over HTTPS.
const origin =
process.env.VERCEL_ENV === 'preview'
? `https://${process.env.VERCEL_URL}`
: process.env.VERCEL_ENV === 'production'
? 'https://nodejs.org'
: 'http://localhost:3000';
/** @type {import('@doc-kit/core/utils/configuration/types.d.ts').Configuration} */
export default {
extends: '@node-core/doc-kit/config',
target: ['html', 'orama-db', 'sitemap'],
global: {
output: 'out/learn',
input: ['pages/**/*.md'],
baseURL: `${origin}/learn`,
// The preset documents the runtime itself, so it points these at
// nodejs/node. Learn is its own repository, and it has no use for the
// release history — leaving it set would fetch and parse the Node.js
// CHANGELOG on every build to populate a version picker we never render.
repository: 'nodejs/learn',
ref: 'main',
changelog: [],
},
'jsx-ast': {
// Off by default in doc-kit 2.x, but the Metabar has always shown it.
showReadingTime: true,
},
html: {
// Important Configuration
project: 'Node.js',
title: '{project} Learn',
pageURL: '{baseURL}{path}.html',
editURL: 'https://github.com/nodejs/learn/edit/main/pages{path}.md',
useAbsoluteURLs: true,
templatePath: join(import.meta.dirname, 'template.html'),
generateAllPage: false,
// Registers the components as islands, so they hydrate client-side
components: {
Authors: join(import.meta.dirname, 'components/Authors/index.jsx'),
Sidebar: join(import.meta.dirname, 'components/Sidebar/index.jsx'),
},
// Imports
imports: {
'#theme/Layout': join(import.meta.dirname, 'components/Layout/index.jsx'),
},
},
sitemap: {
indexURL: '{baseURL}',
pageURL: '{baseURL}{path}',
},
};