Skip to content

Commit 5825eec

Browse files
authored
Learning track 503 bug (#54952)
1 parent 1001d87 commit 5825eec

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/learning-track/middleware/learning-track.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,15 @@ export default async function learningTrack(
8585

8686
// The trackTitle comes from a data .yml file and may use Liquid templating, so we need to render it
8787
const renderOpts = { textOnly: true }
88-
const trackTitle = (await renderContent(track.title, req.context, renderOpts)) as string
88+
// Some translated titles are known to have broken Liquid, so we need to
89+
// try rendering them in English as a fallback.
90+
let trackTitle = ''
91+
try {
92+
trackTitle = (await renderContent(track.title, req.context, renderOpts)) as string
93+
} catch {
94+
const englishFallbackContext = { ...req.context, currentLanguage: 'en' }
95+
trackTitle = (await renderContent(track.title, englishFallbackContext, renderOpts)) as string
96+
}
8997

9098
const currentLearningTrack: LearningTrack = { trackName, trackProduct, trackTitle }
9199
const guidePath = getPathWithoutLanguage(getPathWithoutVersion(req.pagePath))

0 commit comments

Comments
 (0)