Skip to content

Commit

Permalink
Remove page data from menus
Browse files Browse the repository at this point in the history
  • Loading branch information
kilemensi committed Jun 28, 2023
1 parent d50a064 commit 0232a69
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion apps/charterafrica/src/lib/data/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,19 @@ export async function getGlobalProps({ locale, defaultLocale }, api) {
href: "/",
priority: true,
},
menus: menus ?? null,
menus:
menus?.map((originalMenu) => {
const { doc, ...menu } = originalMenu;
// Remove pages (doc) from menu and it's children
// This can also be done via afterRead global hook on navigation block
// but it may interfere with CMS functionality
if (menu.children) {
menu.children =
menu.children?.map(({ doc: _, ...other }) => ({ ...other })) ??
null;
}
return menu;
}) ?? null,
};
const footer = await api.findGlobal("footer", {
locale,
Expand Down

0 comments on commit 0232a69

Please sign in to comment.