Skip to content

Commit ea189d9

Browse files
committed
feat(doc-kit): bump version
1 parent 775888e commit ea189d9

File tree

10 files changed

+478
-147
lines changed

10 files changed

+478
-147
lines changed

components/Footer/footer.json

Lines changed: 0 additions & 62 deletions
This file was deleted.

components/Footer/index.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Footer from '@node-core/ui-components/Containers/Footer';
22
import NavItem from '@node-core/ui-components/Containers/NavBar/NavItem';
33

4-
import { socialLinks, footerLinks } from './footer.json';
4+
import { footer } from '../../site.json' with { type: 'json' };
55

66
// The Node.js Project is legally obligated to include the following text.
77
// It should not be modified unless explicitly requested by OpenJS staff.
@@ -24,7 +24,7 @@ const LegalSlot = (
2424
</p>
2525

2626
<p>
27-
{footerLinks.map(({ link, text }) => (
27+
{footer.links.map(({ link, text }) => (
2828
<NavItem key={link} type="footer" href={link}>
2929
{text}
3030
</NavItem>
@@ -39,7 +39,7 @@ const LegalSlot = (
3939
export default ({ metadata }) => (
4040
<Footer
4141
pathname={metadata.path}
42-
navigation={{ socialLinks }}
42+
navigation={{ socialLinks: footer.social }}
4343
slots={{ legal: LegalSlot }}
4444
/>
4545
);

components/Navigation/index.jsx

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import GitHubIcon from '@node-core/ui-components/Icons/Social/GitHub';
55

66
import SearchBox from '@node-core/doc-kit/src/generators/web/ui/components/SearchBox';
77
import { useTheme } from '@node-core/doc-kit/src/generators/web/ui/hooks/useTheme.mjs';
8-
8+
import { navigation } from '../../site.json' with { type: 'json' };
99
import Logo from '#theme/Logo';
1010

1111
/**
@@ -18,23 +18,7 @@ export default ({ metadata }) => {
1818
<NavBar
1919
Logo={Logo}
2020
sidebarItemTogglerAriaLabel="Toggle navigation menu"
21-
navItems={[
22-
{ link: '/learn', text: 'Learn' },
23-
{ link: '/about', text: 'About' },
24-
{ link: '/download', text: 'Download' },
25-
{ link: '/blog', text: 'Blog' },
26-
{ link: 'https://nodejs.org/docs/latest/api/', text: 'Docs' },
27-
{
28-
link: 'https://github.com/nodejs/node/blob/main/CONTRIBUTING.md',
29-
text: 'Contribute',
30-
target: '_blank',
31-
},
32-
{
33-
link: 'https://training.linuxfoundation.org/openjs/',
34-
text: 'Courses',
35-
target: '_blank',
36-
},
37-
]}
21+
navItems={navigation}
3822
>
3923
<SearchBox pathname={metadata.path} />
4024
<ThemeToggle

components/Sidebar/index.jsx

Lines changed: 10 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
11
import SideBar from '@node-core/ui-components/Containers/Sidebar';
2-
import { relative } from '@node-core/doc-kit/src/utils/url.mjs';
3-
import { pages } from '#theme/config';
4-
5-
/** @type {Array<[string, string]>} */
6-
const categories = [
7-
['getting-started', 'Getting Started'],
8-
['command-line', 'Command Line'],
9-
['http', 'HTTP'],
10-
['manipulating-files', 'Manipulating Files'],
11-
['asynchronous-work', 'Asynchronous Work'],
12-
['typescript', 'TypeScript'],
13-
['modules', 'Modules'],
14-
['diagnostics', 'Diagnostics'],
15-
['test-runner', 'Test Runner'],
16-
];
17-
18-
/** @type {Map<string, Array<{ heading: string, path: string }>>} */
19-
const byDir = new Map();
20-
for (const [heading, path] of pages) {
21-
const dir = path.split('/')[1];
22-
if (!byDir.has(dir)) byDir.set(dir, []);
23-
byDir.get(dir).push({ heading, path });
24-
}
2+
import { sidebar } from '../../site.json' with { type: 'json' };
253

264
/** @param {string} url */
275
const redirect = url => (window.location.href = url);
@@ -31,26 +9,12 @@ const PrefetchLink = props => <a {...props} rel="prefetch" />;
319
/**
3210
* Sidebar component for MDX documentation with page navigation
3311
*/
34-
export default ({ metadata }) => {
35-
const { path: currentPath, basename } = metadata;
36-
const pathname = `${basename}.html`;
37-
38-
const groups = categories.map(([dir, title]) => ({
39-
groupName: title,
40-
items: byDir.get(dir).map(({ heading, path }) => ({
41-
label: heading,
42-
link:
43-
currentPath === path ? pathname : `${relative(path, currentPath)}.html`,
44-
})),
45-
}));
46-
47-
return (
48-
<SideBar
49-
pathname={pathname}
50-
groups={groups}
51-
onSelect={redirect}
52-
as={PrefetchLink}
53-
title="Navigation"
54-
/>
55-
);
56-
};
12+
export default ({ metadata }) => (
13+
<SideBar
14+
pathname={`/learn${metadata.path}`}
15+
groups={sidebar}
16+
onSelect={redirect}
17+
as={PrefetchLink}
18+
title="Navigation"
19+
/>
20+
);

doc-kit.config.mjs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@ export default {
88
input: ['pages/**/*.md'],
99
},
1010
web: {
11-
title: '',
12-
pageURL: 'https://nodejs.org/learn{path}.html',
11+
// Important Configuration
12+
project: 'Node.js',
13+
title: '{project} Learn',
14+
baseURL: 'https://nodejs.org/learn',
15+
pageURL: '{baseURL}{path}.html',
1316
editURL: 'https://github.com/nodejs/learn/edit/main/pages{path}.md',
17+
useAbsoluteURLs: true,
18+
templatePath: join(import.meta.dirname, 'template.html'),
19+
20+
// Imports
1421
imports: {
1522
...web.defaultConfiguration.imports,
1623
'#theme/Layout': join(import.meta.dirname, 'components/Layout/index.jsx'),

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"devDependencies": {
1111
"@eslint/js": "^10.0.1",
12-
"@node-core/doc-kit": "1.3.1",
12+
"@node-core/doc-kit": "1.3.3",
1313
"@node-core/remark-lint": "^1.3.0",
1414
"eslint": "^10.1.0",
1515
"eslint-plugin-mdx": "^3.7.0",

0 commit comments

Comments
 (0)