Skip to content

Commit e8dbc45

Browse files
g-francescaShubhamOulkarbjohansebas
authored
feat: mobile header and sidebar navigation (#2180)
Co-authored-by: shubham oulkar <91728992+ShubhamOulkar@users.noreply.github.com> Co-authored-by: Sebastian Beltran <bjohansebas@gmail.com> Co-authored-by: Shubham Oulkar <oulkarshubhu@gmail.com>
1 parent 474d485 commit e8dbc45

427 files changed

Lines changed: 20852 additions & 2853 deletions

File tree

Some content is hidden

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

astro/CONTRIBUTING.md

Lines changed: 290 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
# Contributing to Expressjs.com
2-
3-
### The Official Documentation of the Express.js Framework
1+
# Contributing to the expressjs.com website
42

53
This is the contribution documentation for the [expressjs.com](https://github.com/expressjs/expressjs.com) website.
64

75
> [!NOTE]
86
> This is not the repo for Express.js framework. To contribute to the _[Express.js framework](https://github.com/expressjs/express)_, check out the [GitHub repo contributing page](https://github.com/expressjs/express?tab=contributing-ov-file) or the website's [Contributing to Express](https://expressjs.com/en/resources/contributing.html) page.
97
10-
#### Need some ideas? These are some typical issues.
8+
### Common contributions
119

12-
1. **Website issues**: If you see anything on the site that could use a tune-up, think about how to fix it.
10+
1. **Website Issues**: Improvements to the site's functionality, design, or accessibility.
1311
- Display or screen sizing problems
1412
- Mobile responsiveness issues
1513
- Missing or broken accessibility features
@@ -27,45 +25,55 @@ This is the contribution documentation for the [expressjs.com](https://github.co
2725
- Fix incorrect/poorly translated words
2826
- Check out the [Contributing translations](#contributing-translations) section below for a contributing guide.
2927

30-
#### Want to work on a backlog issue?
28+
### Working on existing issues
3129

32-
We often have bugs or enhancements that need work. You can find these under our repo's [Issues tab](https://github.com/expressjs/expressjs.com/issues). Check out the tags to find something that's a good match for you.
30+
We welcome contributions to existing bugs or enhancements. You can find these under our repo's [Issues tab](https://github.com/expressjs/expressjs.com/issues). Check out the tags to find something that matches your interests. Look for issues labeled `good first issue` or `help wanted` to get started.
3331

34-
#### Have an idea? Found a bug?
32+
### Reporting bugs & requesting features
3533

36-
If you've found a bug or a typo, or if you have an idea for an enhancement, you can:
34+
If you have found a bug, a typo, or have an idea for an enhancement, you can:
3735

3836
- Submit a [new issue](https://github.com/expressjs/expressjs.com/issues/new/choose) on our repo. Do this for larger proposals, or if you'd like to discuss or get feedback first.
3937

4038
- Make a [GitHub pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request). If you have already done work, and it's ready to go, feel free to send it our way.
4139

4240
## Getting Started
4341

44-
The steps below will guide you through the Expressjs.com contribution process.
42+
The steps below will guide you through the expressjs.com contribution process.
4543

46-
#### Step 1: (OPTIONAL) Open a New Issue
44+
#### Step 1: Open an Issue (Optional)
4745

48-
So you've found a problem that you want to fix, or have a site enhancement you want to make.
46+
If you have identified a problem or an enhancement:
4947

5048
1. If you want to get feedback or discuss, open a discussion [issue](https://github.com/expressjs/expressjs.com/issues/new/choose) prior to starting work. This is not required, but encouraged for larger proposals.
5149
- While we highly encourage this step, it is only for submissions proposing significant change. It helps us to clarify and focus the work, and ensure it aligns with overall project priorities.
5250
- For submissions proposing minor improvements or corrections, this is not needed. You can skip this step.
53-
- When opening an issue please give it a title and fill in the description section. The more details you provide, the more feedback we can give.
51+
- When opening an issue, please provide a clear title and complete description. The more details you provide, the more feedback we can give.
5452

55-
2. After receiving your issue the Express.js documentation team will respond with feedback. We read every submission and always try to respond quickly with feedback.
53+
2. After receiving your issue, the Express.js documentation team will respond with feedback. We review all submissions and aim to respond as soon as possible.
5654
- For submissions proposing significant change, we encourage you to follow the review process before starting work.
5755

58-
#### Step 2: Get the Application Code Base
56+
#### Step 2: Get the project codebase
5957

6058
## Prerequisites
6159

62-
- **Node.js**: v24.13.0 or higher
60+
### Development stack
61+
62+
This project uses:
63+
64+
- **Astro** for site generation
65+
- **TypeScript** for type safety
66+
- **ESLint** for linting
67+
- **Prettier** for formatting
68+
<!-- TODO: add testing framework -->
69+
70+
### Tooling
71+
72+
- **Node.js**: v24.x or higher
6373
- **npm**: v11.0.0 or higher (comes with Node 24)
6474

6575
> We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage Node.js versions. This project includes an `.nvmrc` file for automatic version switching.
6676
67-
## Getting Started
68-
6977
1. **Clone the repository:**
7078

7179
```bash
@@ -96,13 +104,58 @@ So you've found a problem that you want to fix, or have a site enhancement you w
96104

97105
## Available Scripts
98106

99-
| Command | Description |
100-
| ----------------- | ---------------------------------------- |
101-
| `npm run dev` | Start development server with hot reload |
102-
| `npm run build` | Build production site to `./dist` |
103-
| `npm run preview` | Preview production build locally |
107+
| Command | Description |
108+
| ----------------- | ----------------------------------------- |
109+
| `npm run dev` | Start development server with hot reload |
110+
| `npm run build` | Build production site to `./dist` |
111+
| `npm run preview` | Preview production build locally |
112+
| `npm run lint` | Run ESLint to check for issues |
113+
| `npm run check` | Run type checking and format verification |
114+
115+
## Submitting a pull request
116+
117+
1. Create a new branch from `redesign`
118+
2. Make your changes
119+
3. Run `npm run check` to verify code style and types
120+
4. Commit with a clear message
121+
5. Push to your fork
122+
6. Open a PR against `redesign`
123+
124+
> Ensure all checks pass and your branch is up to date with `redesign` before opening a PR.
125+
126+
## Architecture policy
127+
128+
Although Astro supports integrations with frameworks such as React or Vue, this project intentionally avoids additional frontend frameworks.
129+
130+
The expressjs.com website is designed to use:
131+
132+
- HTML
133+
- CSS
134+
- TypeScript
135+
136+
This decision helps keep the codebase lightweight, easier to maintain, and accessible to a broader range of contributors.
137+
138+
### Do not introduce new frontend frameworks
139+
140+
Please do not introduce React, Vue, or other client-side frameworks without prior discussion and approval.
141+
142+
If a proposed feature appears to require a framework integration:
143+
144+
1. Open an issue first.
145+
2. Explain the use case and why the existing stack (HTML, CSS, and TypeScript) is insufficient.
146+
3. Wait for approval from the maintainers before proceeding.
147+
148+
Pull requests that introduce new framework dependencies without prior discussion may be closed.
149+
150+
### Existing exception
104151

105-
## Project Structure
152+
> The search component is implemented using React to support the Orama-powered search experience.
153+
> This is a limited, isolated integration and does not indicate that React (or other frameworks) should be used elsewhere in the project.
154+
155+
> [!IMPORTANT]
156+
> Pull requests that introduce new framework dependencies without prior discussion may not be accepted.
157+
158+
## Project structure
106159

107160
```
108161
astro/
@@ -112,8 +165,10 @@ astro/
112165
│ │ ├── patterns/ # Complex UI patterns
113166
│ │ └── primitives/ # Base UI primitives
114167
│ ├── config/ # Configuration files
168+
│ │ ├── menu/ # Menu configuration files (sidebars)
115169
│ ├── content/ # Content collections
116-
│ │ └── docs/ # Documentation content
170+
│ │ ├── docs/ # Documentation content
171+
│ │ └── resources/ # Resource pages
117172
│ ├── i18n/ # Internationalization
118173
│ ├── layouts/ # Page layouts
119174
│ ├── pages/ # Route pages
@@ -125,5 +180,214 @@ astro/
125180
│ └── utils/ # Utility functions
126181
├── public/ # Static assets
127182
│ └── fonts/ # Font files
128-
└── astro.config.mjs # Astro configuration
183+
├── astro.config.mjs # Astro configuration
184+
```
185+
186+
## Content configuration
187+
188+
The site uses Astro's [Content Collections](https://docs.astro.build/en/guides/content-collections/) to manage documentation and resources. The configuration is defined in `src/content.config.ts`.
189+
190+
### Collections
191+
192+
| Collection | Location | Description |
193+
| ----------- | ------------------------ | --------------------------------- |
194+
| `docs` | `src/content/docs/` | Documentation pages (guides, API) |
195+
| `resources` | `src/content/resources/` | Resource pages (community, tools) |
196+
197+
### Frontmatter schema
198+
199+
Each content file requires frontmatter with the following properties:
200+
201+
```yaml
202+
---
203+
title: 'Page Title' # Required: The page title
204+
description: 'Description' # Optional: Page description for SEO
205+
---
206+
```
207+
208+
## Versioning
209+
210+
The Express.js documentation supports multiple versions. Content is organized by version in the `src/content/docs/` directory.
211+
212+
### Version structure
213+
214+
```
215+
src/content/docs/
216+
└── en/
217+
├── 3x/ # Express 3.x documentation
218+
├── 4x/ # Express 4.x documentation
219+
└── 5x/ # Express 5.x documentation (default)
220+
```
221+
222+
### How versioning works
223+
224+
- **Default Version**: `5x` is the current default version
225+
- **Supported Versions**: `5x`, `4x`, `3x`
226+
- **URL Patterns**:
227+
- Versioned: `/en/5x/api/` → Express 5.x API docs
228+
- Non-versioned: `/en/api/` → Defaults to Express 5.x
229+
230+
### Adding version specific content
231+
232+
1. Create your content file in the appropriate version directory:
233+
234+
```
235+
src/content/docs/en/5x/guide/my-new-page.md
236+
```
237+
238+
2. The versioning system (configured in `src/pages/[lang]/[...slug].astro`) will automatically:
239+
- Serve the page at `/en/5x/guide/my-new-page`
240+
- Create non-versioned aliases for default version content
241+
242+
### Menu configuration
243+
244+
The navigation menus are configured in `src/config/menu/`. The type definitions are in `src/config/types.ts`.
245+
246+
#### Menu structure
247+
248+
Menus are composed of **sections** and **items**:
249+
250+
```
251+
Menu
252+
├── sections[] # Groups of menu items
253+
│ ├── title? # Optional section header
254+
│ ├── basePath? # Base path prepended to all item hrefs
255+
│ ├── omitFrom? # Versions to exclude this section from
256+
│ └── items[] # Menu items in this section
257+
└── items[] # Alternative: flat list of items (no sections)
129258
```
259+
260+
#### Configuration files
261+
262+
| File | Purpose |
263+
| --------------- | ------------------------------------------- |
264+
| `main.ts` | Top-level navigation (Docs, API, Resources) |
265+
| `docs.ts` | Documentation sidebar menu |
266+
| `api.ts` | API reference sidebar menu |
267+
| `resources.ts` | Resources section menu |
268+
| `middleware.ts` | Middleware submenu |
269+
270+
#### Adding menu items
271+
272+
Basic menu item with a link:
273+
274+
```typescript
275+
{ href: `/guide/routing`, label: 'Routing', ariaLabel: 'Routing guide' }
276+
```
277+
278+
Menu item with a submenu:
279+
280+
```typescript
281+
{
282+
label: 'Properties',
283+
ariaLabel: 'Application properties',
284+
submenu: {
285+
items: [
286+
{ href: `/api/application/app-locals`, label: 'app.locals' },
287+
{ href: `/api/application/app-mountpath`, label: 'app.mountpath' },
288+
],
289+
},
290+
}
291+
```
292+
293+
#### Adding sections
294+
295+
Sections group related menu items with an optional title:
296+
297+
```typescript
298+
{
299+
title: 'Getting started',
300+
items: [
301+
{ href: `/starter/installing`, label: 'Installing' },
302+
{ href: `/starter/hello-world`, label: 'Hello world' },
303+
],
304+
}
305+
```
306+
307+
#### Version specific menus
308+
309+
**Enabling versioning on a submenu** — Use `versioned` to specify which versions the menu supports. The version prefix will be automatically prepended to URLs:
310+
311+
```typescript
312+
{
313+
label: 'API Reference',
314+
submenu: {
315+
versioned: ['5x', '4x', '3x'], // Supports all three versions
316+
sections: apiMenu.sections,
317+
},
318+
}
319+
```
320+
321+
**Omitting items from specific versions** — Use `omitFrom` to hide an item in certain versions:
322+
323+
```typescript
324+
{
325+
href: `/api/application/app-mountpath`,
326+
label: 'app.mountpath',
327+
omitFrom: ['3x'], // Not available in Express 3.x
328+
}
329+
```
330+
331+
**Omitting entire sections from specific versions**:
332+
333+
```typescript
334+
{
335+
title: 'Router',
336+
omitFrom: ['3x'], // Router section doesn't exist in 3.x
337+
items: [
338+
{ href: `/api/router/overview`, label: 'Overview' },
339+
],
340+
}
341+
```
342+
343+
#### Type reference
344+
345+
```typescript
346+
type VersionPrefix = '5x' | '4x' | '3x';
347+
348+
type Menu = {
349+
sections?: MenuSection[];
350+
items?: MenuItem[];
351+
basePath?: string;
352+
versioned?: VersionPrefix[];
353+
};
354+
355+
type MenuSection = {
356+
title?: string; // Section header text
357+
basePath?: string; // Prepended to all item hrefs
358+
items: MenuItem[];
359+
omitFrom?: VersionPrefix[]; // Versions to exclude this section from
360+
};
361+
362+
type MenuItem = {
363+
label: string;
364+
ariaLabel?: string;
365+
icon?: string;
366+
href?: string; // Link destination (omit if using submenu)
367+
submenu?: Menu; // Nested menu (omit if using href)
368+
omitFrom?: VersionPrefix[]; // Versions to exclude this item from
369+
};
370+
```
371+
372+
## Contributing translations
373+
374+
We use Crowdin to manage our translations in multiple languages and achieve automatic translation with artificial intelligence. Since these translations can be inefficient in some cases, we need help from the community to provide accurate and helpful translations.
375+
376+
The documentation is translated into these languages:
377+
378+
- Chinese Simplified (`zh-cn`)
379+
- Chinese Traditional (`zh-tw`)
380+
- English (`en`)
381+
- French (`fr`)
382+
- German (`de`)
383+
- Italian (`it`)
384+
- Japanese (`ja`)
385+
- Korean (`ko`)
386+
- Brazilian Portuguese (`pt-br`)
387+
- Spanish (`es`)
388+
389+
### How to translate
390+
391+
1. Request to join the Express.js Website project on [Crowdin](https://express.crowdin.com/website)
392+
2. [Select the language you want to translate](https://support.crowdin.com/for-translators/#starting-translation)
393+
3. [Start translating](https://support.crowdin.com/online-editor/)

0 commit comments

Comments
 (0)