fix: exclude inaccessible links from nav
This commit is contained in:
@@ -29,7 +29,13 @@ export function mapMenuItems(menuItems: MenuItems) {
|
||||
return menuItems.map((menuItem) => {
|
||||
return {
|
||||
...menuItem,
|
||||
links: menuItem.links.map((link) => {
|
||||
links: menuItem.links
|
||||
.filter((link) => {
|
||||
// If content is unpublished or in other way inaccessible in Contentstack
|
||||
// there will be no edges, filter out those links.
|
||||
return !!link.page.edges[0]
|
||||
})
|
||||
.map((link) => {
|
||||
const page = link.page.edges[0].node
|
||||
let originalUrl = undefined
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user