File tree Expand file tree Collapse file tree
middleware/contextualizers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ const { uniq } = require ( 'lodash' )
2+
13module . exports = function earlyAccessContext ( req , res , next ) {
24 if ( process . env . NODE_ENV === 'production' ) {
35 return next ( 404 )
46 }
57
68 // Get a list of all hidden pages per version
7- const earlyAccessPageLinks = req . context . pages
9+ const earlyAccessPageLinks = uniq ( Object . values ( req . context . pages )
810 . filter ( page => page . hidden )
911 // Do not include early access landing page
1012 . filter ( page => page . relativePath !== 'early-access/index.md' )
1113 // Create Markdown links
1214 . map ( page => {
1315 return page . permalinks . map ( permalink => `- [${ permalink . title } ](${ permalink . href } )` )
1416 } )
15- . flat ( )
17+ . flat ( ) )
1618 // Get links for the current version
1719 . filter ( link => link . includes ( req . context . currentVersion ) )
1820 . sort ( )
You can’t perform that action at this time.
0 commit comments