File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
src/learning-track/middleware Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff 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 ) )
You can’t perform that action at this time.
0 commit comments