From b45e78d1eedec74876b9b84496536bd9afab75b3 Mon Sep 17 00:00:00 2001 From: Ahmad Abdolsaheb Date: Tue, 9 Feb 2021 08:51:27 +0300 Subject: [PATCH] fix(client): adjust layoutSelector for i18n (#41005) --- client/utils/gatsby/layoutSelector.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/client/utils/gatsby/layoutSelector.js b/client/utils/gatsby/layoutSelector.js index 94979433ec..7417ae8046 100644 --- a/client/utils/gatsby/layoutSelector.js +++ b/client/utils/gatsby/layoutSelector.js @@ -15,22 +15,21 @@ export default function layoutSelector({ element, props }) { if (element.type === FourOhFourPage) { return {element}; } - if (/^\/certification(\/.*)*/.test(pathname)) { + if (/\/certification\//.test(pathname)) { return ( {element} ); } - if (/^\/guide(\/.*)*/.test(pathname)) { + if (/\/guide\//.test(pathname)) { console.log('Hitting guide for some reason. Need a redirect.'); } const splitPath = pathname.split('/'); - const splitPathThree = splitPath.length > 2 ? splitPath[3] : ''; + const isSuperBlock = + (splitPath.length === 3 && splitPath[1]) || + (splitPath.length === 4 && splitPath[2]); - const isNotSuperBlockIntro = - splitPath.length > 3 && splitPathThree.length > 1; - - if (/^\/learn(\/.*)*/.test(pathname) && isNotSuperBlockIntro) { + if (/\/learn\//.test(pathname) && !isSuperBlock) { return ( {element}