Skip to content

Commit 61d0432

Browse files
authored
Avoid throwing in learning track translations (#55308)
1 parent 6523ef9 commit 61d0432

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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

+12-1
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,20 @@ async function indexOfLearningTrackGuide(
176176
) {
177177
let guideIndex = -1
178178

179+
const renderOpts = { textOnly: true }
179180
for (let i = 0; i < trackGuidePaths.length; i++) {
180181
// Learning track URLs may have Liquid conditionals.
181-
const renderedGuidePath = await renderContent(trackGuidePaths[i], context, { textOnly: true })
182+
let renderedGuidePath = ''
183+
try {
184+
renderedGuidePath = await renderContent(trackGuidePaths[i], context, renderOpts)
185+
} catch {
186+
const englishFallbackContext = { ...context, currentLanguage: 'en' }
187+
renderedGuidePath = await renderContent(
188+
trackGuidePaths[i],
189+
englishFallbackContext,
190+
renderOpts,
191+
)
192+
}
182193

183194
if (!renderedGuidePath) continue
184195

0 commit comments

Comments
 (0)