dotnetthailand / dotnetthailand.github.io

source code for .NET Thailand website (dotnetthailand.com)
https://www.dotnetthailand.com
MIT License
61 stars 100 forks source link

Gatsby build should throw error when someone add the content more than 4 levels of nested folder. #130

Open mildronize opened 3 years ago

mildronize commented 3 years ago

Problem

When someone add the content more than 4 levels of nested folder, it will not be shown in the any result.

As you can see in the code: /src/components/Sidebar/contentTree.js

// ...
// Maximum Deep level of render Nav menu (Start with 0)
const limitDeepLevel = 3;

// ...

const getDeepNavigation = (navItemGroup, navLinkGroup, pathname, deepLevel) => {
    if(deepLevel > limitDeepLevel){ 
      return [];
    }
    // ...
}

Expected Behavior

When Gatsby build, it should throw some error if someone try to break such prohibition.

4 levels of nested folder.

The below image shows 4 levels of nested folder.

image

this folder structure will create the nested navbar like this:

image