From 248a52d360eda5dcb3afa6e57289335ad5325772 Mon Sep 17 00:00:00 2001 From: joostdecock Date: Sat, 27 Apr 2024 16:38:57 +0200 Subject: [PATCH 1/3] fix(shared): Do not count _ key as page child --- sites/shared/utils.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sites/shared/utils.mjs b/sites/shared/utils.mjs index 84e8ce1ff14..8dff35b9390 100644 --- a/sites/shared/utils.mjs +++ b/sites/shared/utils.mjs @@ -339,7 +339,7 @@ export const hasRequiredMeasurements = (Design, measies = {}, DesignIsMeasuremen * and then check if there are any left. If there are, those are child-pages. */ export const pageHasChildren = (page) => - Object.keys(page).filter((key) => !['t', 's', 'o', 'b', 'h'].includes(key)).length > 0 + Object.keys(page).filter((key) => !['t', 's', 'o', 'b', 'h', '_'].includes(key)).length > 0 /* * Returns the slug of the page above this one From 5ce91673b7b5101defe2dffb7d305168589fe09d Mon Sep 17 00:00:00 2001 From: joostdecock Date: Sat, 27 Apr 2024 16:43:59 +0200 Subject: [PATCH 2/3] fix(shared): Apply sitenav filters to ReadMore MDX component A while ago, I rewrote the sitenav component to *just* use the ReadMore MDX component to generate the navigation tree. However, sitenav have certain keys that you can set to control the visibility of hte item to the user, and those filters were not added to the ReadMore component, thus showing navigation items that should have been hidden. --- sites/shared/components/mdx/read-more.mjs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sites/shared/components/mdx/read-more.mjs b/sites/shared/components/mdx/read-more.mjs index 9af3fc62ce4..e96798ee086 100644 --- a/sites/shared/components/mdx/read-more.mjs +++ b/sites/shared/components/mdx/read-more.mjs @@ -26,9 +26,10 @@ const onActivePath = (slug, active) => (active ? active.slice(0, slug.length) == * This is a recursive function, so it needs to be lean */ const RenderTree = ({ tree, recurse, depth = 1, level = 0, active = false }) => { - const orderedTree = orderBy(tree, ['o', 't'], ['asc', 'asc']).filter( - (item) => typeof item === 'object' - ) + const orderedTree = orderBy(tree, ['o', 't'], ['asc', 'asc']) + .filter((item) => typeof item === 'object') + .filter((item) => !item.h) + .filter((item) => !item._) return (