Skip to content

Commit 649cf05

Browse files
authored
Add comprehensive README for src/journeys (#58876)
1 parent 0369bfe commit 649cf05

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

src/journeys/README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Journeys
2+
3+
The **journeys** subject provides guided learning experiences (called "tracks") that help users navigate through a sequence of related documentation articles. Tracks appear on special landing pages and provide contextual navigation to move through articles in a structured learning path.
4+
5+
## Purpose & Scope
6+
7+
This subject is responsible for:
8+
- Rendering journey landing pages that display multiple learning tracks
9+
- Providing prev/next navigation within journey track articles
10+
- Resolving journey context based on the current article path
11+
- Rendering Liquid templates in journey metadata (titles, descriptions, guide paths)
12+
13+
Journey tracks are defined in article frontmatter using the `journeyTracks` field on pages with `layout: journey-landing`.
14+
15+
## Architecture & Key Assets
16+
17+
```
18+
src/journeys/
19+
├── components/
20+
│ ├── JourneyTrackCard.tsx # Card showing journey progress with next/prev links
21+
│ ├── JourneyTrackNav.tsx # Navigation bar for prev/next articles in a track
22+
│ └── index.ts # Component exports
23+
├── lib/
24+
│ ├── get-link-data.ts # Fetches title and href data for journey guide links
25+
│ └── journey-path-resolver.ts # Core logic: resolves journey context and tracks
26+
├── middleware/
27+
│ └── journey-track.ts # Express middleware that attaches journey data to requests
28+
└── tests/
29+
└── journey-path-resolver.ts # Unit tests for journey resolution logic
30+
```
31+
32+
33+
34+
## Setup & Usage
35+
36+
### Prerequisites
37+
- Journey landing pages must have `layout: journey-landing` in their frontmatter
38+
- Journey tracks are defined in the `journeyTracks` frontmatter field (see example below)
39+
40+
### Running tests
41+
```bash
42+
npm run test -- src/journeys/tests
43+
```
44+
45+
### Example frontmatter for journey landing page
46+
```yaml
47+
---
48+
title: Enterprise onboarding
49+
layout: journey-landing
50+
journeyTracks:
51+
- id: 'getting_started'
52+
title: 'Getting started with {% data variables.product.prodname_ghe_cloud %}'
53+
description: 'Master the fundamentals and get started with a trial.'
54+
guides:
55+
- '/enterprise-onboarding/choose-an-enterprise-type'
56+
- '/enterprise-onboarding/setting-up-a-trial'
57+
- '/enterprise-onboarding/adding-users'
58+
---
59+
```
60+
61+
## Data & External Dependencies
62+
63+
### Data inputs
64+
- **Content frontmatter**: `journeyTracks` field on landing pages defines track structure
65+
- **Article metadata**: Article titles and paths are resolved via `get-link-data.ts`
66+
- **Liquid variables**: Track titles, descriptions, and guide paths support Liquid templating
67+
68+
### Dependencies
69+
- **`@/content-render`**: Used to render Liquid templates in journey metadata
70+
- **`@/frame/lib/path-utils`**: Normalizes paths for consistent matching
71+
- **`@/versions`**: Checks version compatibility between journey pages and articles
72+
- **`@/languages`**: Executes rendering with fallback for internationalization
73+
- **`@/landings`**: Journey components are consumed by landing page layouts
74+
75+
### Data outputs
76+
- **`req.context.currentJourneyTrack`**: Journey context object with track info and prev/next links
77+
- **`req.context.page.resolvedJourneyTracks`**: Array of resolved track data for landing pages
78+
79+
## Current State & Next Steps
80+
81+
### Known limitations
82+
- Journey tracks currently inherit version constraints from their landing page
83+
- Path normalization logic must stay synchronized with other path-handling middleware
84+
- Journey context resolution has some performance overhead due to iterating all pages
85+
- Currently only support a particular page belonging to a single journey track/step - we won't show nav components for all the journeys an article belongs to
86+
87+
Continued work to expand and add more journey tracks.

0 commit comments

Comments
 (0)