hasura / gatsby-gitbook-starter

Generate GitBook style modern docs/tutorial websites using Gatsby + MDX
https://hasura.io/learn/graphql/react/introduction/
MIT License
983 stars 378 forks source link

using trailingSlash: true causes sidebar not to be sorted correctly #58

Closed aappddeevv closed 3 years ago

aappddeevv commented 4 years ago

It looks like the algorithm src/components/sidebar/tree.js:calculateTreeData fails to produce a properly sorted sidebar if trailingSlash:true is used in config.js.

praveenweb commented 4 years ago

@aappddeevv - When trailingSlash true is used, the sidebar links config also needs to include a trailing slash. For example:

"sidebar": {
    "forcedNavOrder": [
        "/introduction", // add trailing slash if enabled above
            "/codeblock"
    ],
        "collapsedNav": [
            "/codeblock" // add trailing slash if enabled above
        ],
    "links": [
        { "text": "Hasura", "link": "https://hasura.io"},
    ],
    "frontline": false,
    "ignoreIndex": true,
},

You would need to add slash to each URL. (/introduction/ , /codeblock/) etc. This was done to maintain backwards compatibility since it's a newly added feature.