(link, context, option)
| 25 | } |
| 26 | |
| 27 | async function processLink(link, context, option) { |
| 28 | const opts = { textOnly: true } |
| 29 | // Parse the link in case it includes Liquid conditionals |
| 30 | const linkPath = await renderContent(link.href || link, context, opts) |
| 31 | if (!linkPath) return null |
| 32 | |
| 33 | const version = |
| 34 | context.currentVersion === 'homepage' ? nonEnterpriseDefaultVersion : context.currentVersion |
| 35 | const href = removeFPTFromPath(path.join('/', context.currentLanguage, version, linkPath)) |
| 36 | |
| 37 | const linkedPage = findPage(href, context.pages, context.redirects) |
| 38 | if (!linkedPage) return null |
| 39 | |
| 40 | const result = { href, page: linkedPage } |
| 41 | |
| 42 | if (option.title) { |
| 43 | result.title = await linkedPage.renderTitle(context, opts) |
| 44 | } |
| 45 | |
| 46 | if (option.fullTitle) { |
| 47 | opts.preferShort = false |
| 48 | result.fullTitle = await linkedPage.renderTitle(context, opts) |
| 49 | } |
| 50 | |
| 51 | if (option.intro) { |
| 52 | result.intro = await linkedPage.renderProp('intro', context, opts) |
| 53 | } |
| 54 | return result |
| 55 | } |
no test coverage detected