Skip to content

Commit 156000f

Browse files
authored
fix link back to journey page href (#58103)
1 parent 364e9f8 commit 156000f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/journeys/components/JourneyTrackCard.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@ import { useRouter } from 'next/router'
33
import { Link } from '@/frame/components/Link'
44
import type { JourneyContext } from '@/journeys/lib/journey-path-resolver'
55
import { useTranslation } from '@/languages/components/useTranslation'
6+
import { useVersion } from '@/versions/components/useVersion'
67

78
type Props = {
89
journey: JourneyContext
910
}
1011

1112
export function JourneyTrackCard({ journey }: Props) {
1213
const { locale } = useRouter()
14+
const { currentVersion } = useVersion()
1315
const { t } = useTranslation('journey_track_nav')
1416
const { trackTitle, journeyTitle, journeyPath, nextGuide, numberOfGuides, currentGuideIndex } =
1517
journey
18+
const fullPath = `/${locale}/${currentVersion}${journeyPath}?feature=journey-landing`
1619

1720
return (
1821
<div
@@ -21,7 +24,7 @@ export function JourneyTrackCard({ journey }: Props) {
2124
>
2225
<div className="d-flex flex-column width-full">
2326
<h2 className="h4">
24-
<Link href={`/${locale}${journeyPath}`} className="mb-1 text-underline">
27+
<Link href={fullPath} className="mb-1 text-underline">
2528
{journeyTitle}
2629
</Link>
2730
</h2>
@@ -41,7 +44,7 @@ export function JourneyTrackCard({ journey }: Props) {
4144
</Link>
4245
</>
4346
) : (
44-
<Link href={`/${locale}${journeyPath}`} className="h5 text-bold color-fg f5 ml-1">
47+
<Link href={fullPath} className="h5 text-bold color-fg f5 ml-1">
4548
{t('more_articles')}
4649
</Link>
4750
)}

src/journeys/lib/journey-path-resolver.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { getPathWithoutLanguage, getPathWithoutVersion } from '@/frame/lib/path-
22
import { renderContent } from '@/content-render/index'
33
import { executeWithFallback } from '@/languages/lib/render-with-fallback'
44
import getApplicableVersions from '@/versions/lib/get-applicable-versions'
5+
import Permalink from '@/frame/lib/permalink'
56
import getLinkData from './get-link-data'
67

78
export interface JourneyContext {
@@ -170,7 +171,8 @@ export async function resolveJourneyContext(
170171
trackName: track.id,
171172
trackTitle: track.title,
172173
journeyTitle: journeyPage.title || '',
173-
journeyPath: journeyPage.permalink || `/${journeyPage.relativePath || ''}`,
174+
journeyPath:
175+
journeyPage.permalink || Permalink.relativePathToSuffix(journeyPage.relativePath || ''),
174176
currentGuideIndex: guideIndex,
175177
numberOfGuides: track.guides.length,
176178
}

0 commit comments

Comments
 (0)