Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 0 additions & 62 deletions components/Footer/footer.json

This file was deleted.

6 changes: 3 additions & 3 deletions components/Footer/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Footer from '@node-core/ui-components/Containers/Footer';
import NavItem from '@node-core/ui-components/Containers/NavBar/NavItem';

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

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

<p>
{footerLinks.map(({ link, text }) => (
{footer.links.map(({ link, text }) => (
<NavItem key={link} type="footer" href={link}>
{text}
</NavItem>
Expand All @@ -39,7 +39,7 @@ const LegalSlot = (
export default ({ metadata }) => (
<Footer
pathname={metadata.path}
navigation={{ socialLinks }}
navigation={{ socialLinks: footer.social }}
slots={{ legal: LegalSlot }}
/>
);
20 changes: 2 additions & 18 deletions components/Navigation/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import GitHubIcon from '@node-core/ui-components/Icons/Social/GitHub';

import SearchBox from '@node-core/doc-kit/src/generators/web/ui/components/SearchBox';
import { useTheme } from '@node-core/doc-kit/src/generators/web/ui/hooks/useTheme.mjs';

import { navigation } from '../../site.json' with { type: 'json' };
import Logo from '#theme/Logo';

/**
Expand All @@ -18,23 +18,7 @@ export default ({ metadata }) => {
<NavBar
Logo={Logo}
sidebarItemTogglerAriaLabel="Toggle navigation menu"
navItems={[
{ link: '/learn', text: 'Learn' },
{ link: '/about', text: 'About' },
{ link: '/download', text: 'Download' },
{ link: '/blog', text: 'Blog' },
{ link: 'https://nodejs.org/docs/latest/api/', text: 'Docs' },
{
link: 'https://github.com/nodejs/node/blob/main/CONTRIBUTING.md',
text: 'Contribute',
target: '_blank',
},
{
link: 'https://training.linuxfoundation.org/openjs/',
text: 'Courses',
target: '_blank',
},
]}
navItems={navigation}
>
<SearchBox pathname={metadata.path} />
<ThemeToggle
Expand Down
56 changes: 10 additions & 46 deletions components/Sidebar/index.jsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,5 @@
import SideBar from '@node-core/ui-components/Containers/Sidebar';
import { relative } from '@node-core/doc-kit/src/utils/url.mjs';
import { pages } from '#theme/config';

/** @type {Array<[string, string]>} */
const categories = [
['getting-started', 'Getting Started'],
['command-line', 'Command Line'],
['http', 'HTTP'],
['manipulating-files', 'Manipulating Files'],
['asynchronous-work', 'Asynchronous Work'],
['typescript', 'TypeScript'],
['modules', 'Modules'],
['diagnostics', 'Diagnostics'],
['test-runner', 'Test Runner'],
];

/** @type {Map<string, Array<{ heading: string, path: string }>>} */
const byDir = new Map();
for (const [heading, path] of pages) {
const dir = path.split('/')[1];
if (!byDir.has(dir)) byDir.set(dir, []);
byDir.get(dir).push({ heading, path });
}
import { sidebar } from '../../site.json' with { type: 'json' };

/** @param {string} url */
const redirect = url => (window.location.href = url);
Expand All @@ -31,26 +9,12 @@ const PrefetchLink = props => <a {...props} rel="prefetch" />;
/**
* Sidebar component for MDX documentation with page navigation
*/
export default ({ metadata }) => {
const { path: currentPath, basename } = metadata;
const pathname = `${basename}.html`;

const groups = categories.map(([dir, title]) => ({
groupName: title,
items: byDir.get(dir).map(({ heading, path }) => ({
label: heading,
link:
currentPath === path ? pathname : `${relative(path, currentPath)}.html`,
})),
}));

return (
<SideBar
pathname={pathname}
groups={groups}
onSelect={redirect}
as={PrefetchLink}
title="Navigation"
/>
);
};
export default ({ metadata }) => (
<SideBar
pathname={`/learn${metadata.path}`}
groups={sidebar}
onSelect={redirect}
as={PrefetchLink}
title="Navigation"
/>
);
14 changes: 12 additions & 2 deletions doc-kit.config.mjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
import web from '@node-core/doc-kit/src/generators/web/index.mjs';
import { join } from 'node:path';

const origin =
process.env.VERCEL_ENV === 'preview' ? process.env.VERCEL_URL : 'nodejs.org';

/** @type {import('@node-core/doc-kit/src/utils/configuration/types.d.ts').Configuration} */
export default {
global: {
output: 'out/learn',
input: ['pages/**/*.md'],
},
web: {
title: '',
pageURL: 'https://nodejs.org/learn{path}.html',
// Important Configuration
project: 'Node.js',
title: '{project} Learn',
baseURL: `https://${origin}/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'),

// Imports
imports: {
...web.defaultConfiguration.imports,
'#theme/Layout': join(import.meta.dirname, 'components/Layout/index.jsx'),
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@node-core/doc-kit": "1.3.1",
"@node-core/doc-kit": "1.3.3",
"@node-core/remark-lint": "^1.3.0",
"eslint": "^10.1.0",
"eslint-plugin-mdx": "^3.7.0",
Expand Down
Loading
Loading