Skip to content

Commit 549c97c

Browse files
authored
show journey nav and support journey article branching text frontmatter (#58848)
1 parent efe839b commit 549c97c

File tree

23 files changed

+413
-164
lines changed

23 files changed

+413
-164
lines changed

content/README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,9 @@ includeGuides:
259259
- `id` (required): Unique identifier for the journey. The id only needs to be unique for journeys within a single journey landing page.
260260
- `title` (required): Display title for the journey (supports Liquid variables)
261261
- `description` (optional): Description of the journey (supports Liquid variables)
262-
- `guides` (required): Array of article paths that make up this journey
262+
- `guides` (required): Array of guide objects that make up this journey. Each guide object has:
263+
- `href` (required): Path to the article
264+
- `alternativeNextStep` (optional): Custom text to guide users to alternative paths in the journey. Supports Liquid variables and `[AUTOTITLE]`.
263265
- Only applicable when used with `layout: journey-landing`.
264266
- Optional.
265267

@@ -271,15 +273,16 @@ journeyTracks:
271273
title: 'Getting started with {% data variables.product.prodname_actions %}'
272274
description: 'Learn the basics of GitHub Actions.'
273275
guides:
274-
- '/actions/quickstart'
275-
- '/actions/learn-github-actions'
276-
- '/actions/using-workflows'
276+
- href: '/actions/quickstart'
277+
- href: '/actions/learn-github-actions'
278+
alternativeNextStep: 'Want to skip ahead? See [AUTOTITLE](/actions/using-workflows).'
279+
- href: '/actions/using-workflows'
277280
- id: 'advanced'
278281
title: 'Advanced {% data variables.product.prodname_actions %}'
279282
description: 'Dive deeper into advanced features.'
280283
guides:
281-
- '/actions/using-workflows/workflow-syntax-for-github-actions'
282-
- '/actions/deployment/deploying-with-github-actions'
284+
- href: '/actions/using-workflows/workflow-syntax-for-github-actions'
285+
- href: '/actions/deployment/deploying-with-github-actions'
283286
```
284287

285288
### `type`

content/contributing/writing-for-github-docs/using-yaml-frontmatter.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ includeGuides:
257257
* `id` (required): Unique identifier for the journey. The id only needs to be unique for journeys within a single journey landing page.
258258
* `title` (required): Display title for the journey (supports Liquid variables)
259259
* `description` (optional): Description of the journey (supports Liquid variables)
260-
* `guides` (required): Array of article paths that make up this journey
260+
* `guides` (required): Array of guide objects that make up this journey. Each guide object has:
261+
* `href` (required): Path to the article
262+
* `alternativeNextStep` (optional): Custom text to guide users to alternative paths in the journey. Supports Liquid variables and `[AUTOTITLE]`.
261263
* Only applicable when used with `layout: journey-landing`.
262264
* Optional.
263265

@@ -269,15 +271,16 @@ journeyTracks:
269271
title: 'Getting started with {% data variables.product.prodname_actions %}'
270272
description: 'Learn the basics of GitHub Actions.'
271273
guides:
272-
- '/actions/quickstart'
273-
- '/actions/learn-github-actions'
274-
- '/actions/using-workflows'
274+
- href: '/actions/quickstart'
275+
- href: '/actions/learn-github-actions'
276+
alternativeNextStep: 'Want to skip ahead? See [AUTOTITLE](/actions/using-workflows).'
277+
- href: '/actions/using-workflows'
275278
- id: 'advanced'
276279
title: 'Advanced {% data variables.product.prodname_actions %}'
277280
description: 'Dive deeper into advanced features.'
278281
guides:
279-
- '/actions/using-workflows/workflow-syntax-for-github-actions'
280-
- '/actions/deployment/deploying-with-github-actions'
282+
- href: '/actions/using-workflows/workflow-syntax-for-github-actions'
283+
- href: '/actions/deployment/deploying-with-github-actions'
281284
```
282285

283286
### `type`

content/enterprise-onboarding/index.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,56 +16,56 @@ journeyTracks:
1616
title: 'Getting started with your enterprise'
1717
description: 'Master the fundamentals of {% data variables.product.prodname_ghe_cloud %} and get started with a trial.'
1818
guides:
19-
- '/enterprise-onboarding/getting-started-with-your-enterprise/choose-an-enterprise-type'
20-
- '/enterprise-onboarding/getting-started-with-your-enterprise/setting-up-a-trial-of-github-enterprise'
21-
- '/enterprise-onboarding/getting-started-with-your-enterprise/adding-users-to-your-enterprise'
22-
- '/enterprise-onboarding/getting-started-with-your-enterprise/about-enterprise-billing'
23-
- '/enterprise-onboarding/getting-started-with-your-enterprise/about-migrating-to-github-enterprise-cloud'
19+
- href: '/enterprise-onboarding/getting-started-with-your-enterprise/choose-an-enterprise-type'
20+
- href: '/enterprise-onboarding/getting-started-with-your-enterprise/setting-up-a-trial-of-github-enterprise'
21+
- href: '/enterprise-onboarding/getting-started-with-your-enterprise/adding-users-to-your-enterprise'
22+
- href: '/enterprise-onboarding/getting-started-with-your-enterprise/about-enterprise-billing'
23+
- href: '/enterprise-onboarding/getting-started-with-your-enterprise/about-migrating-to-github-enterprise-cloud'
2424
- id: 'setting_up_organizations_and_teams'
2525
title: 'Setting up organizations and teams in your enterprise'
2626
description: 'Organize work effectively and ensure people have the access they need to resources and administrative settings.'
2727
guides:
28-
- '/enterprise-onboarding/setting-up-organizations-and-teams/best-practices'
29-
- '/enterprise-onboarding/setting-up-organizations-and-teams/setting-up-an-organization'
30-
- '/enterprise-onboarding/setting-up-organizations-and-teams/about-roles-in-an-enterprise'
31-
- '/enterprise-onboarding/setting-up-organizations-and-teams/identify-role-requirements'
32-
- '/enterprise-onboarding/setting-up-organizations-and-teams/creating-custom-roles'
33-
- '/enterprise-onboarding/setting-up-organizations-and-teams/about-teams-in-an-enterprise'
34-
- '/enterprise-onboarding/setting-up-organizations-and-teams/creating-teams'
35-
- '/enterprise-onboarding/setting-up-organizations-and-teams/assigning-roles-to-teams-and-users'
36-
- '/enterprise-onboarding/setting-up-organizations-and-teams/use-innersource'
28+
- href: '/enterprise-onboarding/setting-up-organizations-and-teams/best-practices'
29+
- href: '/enterprise-onboarding/setting-up-organizations-and-teams/setting-up-an-organization'
30+
- href: '/enterprise-onboarding/setting-up-organizations-and-teams/about-roles-in-an-enterprise'
31+
- href: '/enterprise-onboarding/setting-up-organizations-and-teams/identify-role-requirements'
32+
- href: '/enterprise-onboarding/setting-up-organizations-and-teams/creating-custom-roles'
33+
- href: '/enterprise-onboarding/setting-up-organizations-and-teams/about-teams-in-an-enterprise'
34+
- href: '/enterprise-onboarding/setting-up-organizations-and-teams/creating-teams'
35+
- href: '/enterprise-onboarding/setting-up-organizations-and-teams/assigning-roles-to-teams-and-users'
36+
- href: '/enterprise-onboarding/setting-up-organizations-and-teams/use-innersource'
3737
- id: 'support_for_your_enterprise'
3838
title: 'Creating a support model for your enterprise'
3939
description: 'Find out how to get help and choose who will be able to contact Support.'
4040
guides:
41-
- '/enterprise-onboarding/support-for-your-enterprise/understanding-support'
42-
- '/enterprise-onboarding/support-for-your-enterprise/using-the-support-portal'
43-
- '/enterprise-onboarding/support-for-your-enterprise/managing-support-entitlements'
41+
- href: '/enterprise-onboarding/support-for-your-enterprise/understanding-support'
42+
- href: '/enterprise-onboarding/support-for-your-enterprise/using-the-support-portal'
43+
- href: '/enterprise-onboarding/support-for-your-enterprise/managing-support-entitlements'
4444
- id: 'govern_people_and_repositories'
4545
title: 'Governing people and repositories'
4646
description: 'Implement policies, custom properties, and rulesets to govern users and repositories across your enterprise.'
4747
guides:
48-
- '/enterprise-onboarding/govern-people-and-repositories/about-enterprise-policies'
49-
- '/enterprise-onboarding/govern-people-and-repositories/create-custom-properties'
50-
- '/enterprise-onboarding/govern-people-and-repositories/create-repository-policies'
51-
- '/enterprise-onboarding/govern-people-and-repositories/protect-branches'
52-
- '/enterprise-onboarding/govern-people-and-repositories/using-the-audit-log-for-your-enterprise'
53-
- '/enterprise-onboarding/govern-people-and-repositories/about-enterprise-security'
48+
- href: '/enterprise-onboarding/govern-people-and-repositories/about-enterprise-policies'
49+
- href: '/enterprise-onboarding/govern-people-and-repositories/create-custom-properties'
50+
- href: '/enterprise-onboarding/govern-people-and-repositories/create-repository-policies'
51+
- href: '/enterprise-onboarding/govern-people-and-repositories/protect-branches'
52+
- href: '/enterprise-onboarding/govern-people-and-repositories/using-the-audit-log-for-your-enterprise'
53+
- href: '/enterprise-onboarding/govern-people-and-repositories/about-enterprise-security'
5454
- id: 'github_apps'
5555
title: 'Automating processes with GitHub Apps'
5656
description: 'Create and install apps to automate processes securely in your enterprise and organizations.'
5757
guides:
58-
- '/enterprise-onboarding/github-apps/create-enterprise-apps'
59-
- '/enterprise-onboarding/github-apps/install-enterprise-apps'
58+
- href: '/enterprise-onboarding/github-apps/create-enterprise-apps'
59+
- href: '/enterprise-onboarding/github-apps/install-enterprise-apps'
6060
- id: 'github_actions_for_your_enterprise'
6161
title: 'Setting up CI/CD with GitHub Actions'
6262
description: 'Explore {% data variables.product.prodname_actions %}, plan your rollout, and get started.'
6363
guides:
64-
- '/enterprise-onboarding/github-actions-for-your-enterprise/about-github-actions-for-enterprises'
65-
- '/enterprise-onboarding/github-actions-for-your-enterprise/actions-components'
66-
- '/enterprise-onboarding/github-actions-for-your-enterprise/planning-a-rollout-of-github-actions'
67-
- '/enterprise-onboarding/github-actions-for-your-enterprise/migrating-your-enterprise-to-github-actions'
68-
- '/enterprise-onboarding/github-actions-for-your-enterprise/getting-started-with-github-actions-for-github-enterprise-cloud'
64+
- href: '/enterprise-onboarding/github-actions-for-your-enterprise/about-github-actions-for-enterprises'
65+
- href: '/enterprise-onboarding/github-actions-for-your-enterprise/actions-components'
66+
- href: '/enterprise-onboarding/github-actions-for-your-enterprise/planning-a-rollout-of-github-actions'
67+
- href: '/enterprise-onboarding/github-actions-for-your-enterprise/migrating-your-enterprise-to-github-actions'
68+
- href: '/enterprise-onboarding/github-actions-for-your-enterprise/getting-started-with-github-actions-for-github-enterprise-cloud'
6969
versions:
7070
ghec: '*'
7171
topics:

content/get-started/start-your-journey/index.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ journeyTracks:
2828
title: 'Get started'
2929
description: 'Master the fundamentals of {% data variables.product.github %} and Git.'
3030
guides:
31-
- '/get-started/start-your-journey/about-github-and-git'
32-
- '/get-started/start-your-journey/creating-an-account-on-github'
33-
- '/get-started/start-your-journey/hello-world'
34-
- '/get-started/start-your-journey/setting-up-your-profile'
35-
- '/get-started/start-your-journey/finding-inspiration-on-github'
36-
- '/get-started/start-your-journey/downloading-files-from-github'
37-
- '/get-started/start-your-journey/uploading-a-project-to-github'
38-
- '/get-started/start-your-journey/git-and-github-learning-resources'
31+
- href: '/get-started/start-your-journey/about-github-and-git'
32+
- href: '/get-started/start-your-journey/creating-an-account-on-github'
33+
- href: '/get-started/start-your-journey/hello-world'
34+
- href: '/get-started/start-your-journey/setting-up-your-profile'
35+
- href: '/get-started/start-your-journey/finding-inspiration-on-github'
36+
- href: '/get-started/start-your-journey/downloading-files-from-github'
37+
- href: '/get-started/start-your-journey/uploading-a-project-to-github'
38+
- href: '/get-started/start-your-journey/git-and-github-learning-resources'
3939
---

src/content-linter/lib/linting-rules/journey-tracks-guide-path-exists.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,19 @@ export const journeyTracksGuidePathExists = {
7171
const trackObj = track as Record<string, unknown>
7272
if (trackObj.guides && Array.isArray(trackObj.guides)) {
7373
for (let guideIndex = 0; guideIndex < trackObj.guides.length; guideIndex++) {
74-
const guide: string = trackObj.guides[guideIndex]
75-
if (typeof guide === 'string') {
76-
if (!isValidGuidePath(guide, params.name)) {
74+
const guideObj = trackObj.guides[guideIndex]
75+
76+
// Validate guide is an object with expected properties
77+
if (!guideObj || typeof guideObj !== 'object') continue
78+
79+
// Validate href property
80+
if ('href' in guideObj && typeof guideObj.href === 'string') {
81+
if (!isValidGuidePath(guideObj.href, params.name)) {
7782
addError(
7883
onError,
7984
journeyTracksLineNumber,
80-
`Journey track guide path does not exist: ${guide} (track ${trackIndex + 1}, guide ${guideIndex + 1})`,
81-
guide,
85+
`Journey track guide path does not exist: ${guideObj.href} (track ${trackIndex + 1}, guide ${guideIndex + 1})`,
86+
guideObj.href,
8287
)
8388
}
8489
}

src/content-linter/lib/linting-rules/journey-tracks-liquid.ts

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,38 @@ export const journeyTracksLiquid = {
7575

7676
if (track.guides && Array.isArray(track.guides)) {
7777
for (let guideIndex = 0; guideIndex < track.guides.length; guideIndex++) {
78-
const guide: string = track.guides[guideIndex]
79-
if (typeof guide === 'string') {
78+
const guideObj = track.guides[guideIndex]
79+
80+
// Validate guide is an object with expected properties
81+
if (!guideObj || typeof guideObj !== 'object') continue
82+
83+
// Validate href property
84+
if ('href' in guideObj && typeof guideObj.href === 'string') {
85+
try {
86+
liquid.parse(guideObj.href)
87+
} catch (error: any) {
88+
addError(
89+
onError,
90+
trackLineNumber,
91+
`Invalid Liquid syntax in journey track guide href (track ${trackIndex + 1}, guide ${guideIndex + 1}): ${error.message}`,
92+
guideObj.href,
93+
)
94+
}
95+
}
96+
97+
// Validate alternativeNextStep property if present
98+
if (
99+
'alternativeNextStep' in guideObj &&
100+
typeof guideObj.alternativeNextStep === 'string'
101+
) {
80102
try {
81-
liquid.parse(guide)
103+
liquid.parse(guideObj.alternativeNextStep)
82104
} catch (error: any) {
83105
addError(
84106
onError,
85107
trackLineNumber,
86-
`Invalid Liquid syntax in journey track guide (track ${trackIndex + 1}, guide ${guideIndex + 1}): ${error.message}`,
87-
guide,
108+
`Invalid Liquid syntax in journey track guide alternativeNextStep (track ${trackIndex + 1}, guide ${guideIndex + 1}): ${error.message}`,
109+
guideObj.alternativeNextStep,
88110
)
89111
}
90112
}

src/content-linter/tests/fixtures/journey-tracks/duplicate-ids.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ journeyTracks:
1111
- id: duplicate-id
1212
title: "First Track"
1313
guides:
14-
- /article-one
14+
- href: /article-one
1515
- id: unique-id
1616
title: "Unique Track"
1717
guides:
18-
- /article-two
18+
- href: /article-two
1919
- id: duplicate-id
2020
title: "Second Track with Same ID"
2121
guides:
22-
- /subdir/article-three
22+
- href: /subdir/article-three
2323
---
2424

2525
# Journey with Duplicate IDs

src/content-linter/tests/fixtures/journey-tracks/invalid-paths.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ journeyTracks:
1111
- id: track-1
1212
title: "Track with Invalid Guides"
1313
guides:
14-
- /article-one
15-
- /nonexistent/guide
16-
- /another/invalid/path
14+
- href: /article-one
15+
- href: /nonexistent/guide
16+
- href: /another/invalid/path
1717
---
1818

1919
# Journey with Invalid Paths

src/content-linter/tests/fixtures/journey-tracks/non-journey-layout.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ journeyTracks:
1111
- id: track-1
1212
title: "Should be ignored"
1313
guides:
14-
- /nonexistent/path
14+
- href: /nonexistent/path
1515
---
1616

1717
# Non-Journey Page

src/content-linter/tests/fixtures/journey-tracks/valid-journey.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ journeyTracks:
1111
- id: track-1
1212
title: "Getting Started Track"
1313
guides:
14-
- /article-one
15-
- /article-two
14+
- href: /article-one
15+
- href: /article-two
1616
- id: track-2
1717
title: "Advanced Track"
1818
guides:
19-
- /subdir/article-three
19+
- href: /subdir/article-three
2020
---
2121

2222
# Valid Journey Landing

0 commit comments

Comments
 (0)