1
0
mirror of synced 2025-12-25 02:17:36 -05:00

support conditionals in sublanding FM props

This commit is contained in:
Sarah Schneider
2021-04-01 10:01:23 -04:00
parent 8940bafac5
commit ee53f96dad

View File

@@ -202,16 +202,21 @@ class Page {
if (this.learningTracks) {
const learningTracks = []
for await (const trackName of this.rawLearningTracks) {
const track = context.site.data['learning-tracks'][context.currentProduct][trackName]
for await (const rawTrackName of this.rawLearningTracks) {
// Track names in frontmatter may include Liquid conditionals
const renderedTrackName = await renderContent(rawTrackName, context, { textOnly: true, encodeEntities: true })
if (!renderedTrackName) continue
const track = context.site.data['learning-tracks'][context.currentProduct][renderedTrackName]
if (!track) continue
learningTracks.push({
trackName,
trackName: renderedTrackName,
title: await renderContent(track.title, context, { textOnly: true, encodeEntities: true }),
description: await renderContent(track.description, context, { textOnly: true, encodeEntities: true }),
guides: await getLinkData(track.guides, context)
})
}
this.learningTracks = learningTracks
}