support conditionals in sublanding FM props
This commit is contained in:
11
lib/page.js
11
lib/page.js
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user