Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

featured-links.js 609 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  1. const getLinkData = require('../lib/get-link-data')
  2. // this middleware adds properties to the context object
  3. module.exports = async function featuredLinks (req, res, next) {
  4. if (!req.context.page) return next()
  5. if (!(req.context.page.relativePath.endsWith('index.md') || req.context.page.layout === 'product-landing')) return next()
  6. if (!req.context.page.featuredLinks) return next()
  7. req.context.featuredLinks = {}
  8. for (const key in req.context.page.featuredLinks) {
  9. req.context.featuredLinks[key] = await getLinkData(req.context.page.featuredLinks[key], req.context)
  10. }
  11. return next()
  12. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...