Place Introduction subsection under main Introduction page#32
Open
HebeHH wants to merge 2 commits intohrishioa:masterfrom
Open
Place Introduction subsection under main Introduction page#32HebeHH wants to merge 2 commits intohrishioa:masterfrom
HebeHH wants to merge 2 commits intohrishioa:masterfrom
Conversation
Owner
|
@HebeHH This might be a good idea - but this monkeypatch (so named because it relies on the model to call the intro section 'introduction' :)) might conflict with my monkeypatch. Have you tested a full generation on it? I recommend you make this a PR to your folder PR, and then test both on a full set of code for functionality, and we can merge. |
Owner
|
@HebeHH can you test a full generation on a clean directory? If this works I'd love to merge it! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Problem
Currently there is a pretty common issue where sub-sections generated under the introduction are not attached to it in the sidebar:

Ideally these would be placed under the heading correctly like so:

Why it happens
This is because the introduction main section is called

index.mdxand then the introduction sub-sections are in a folder calledintroduction/:In order for next to display it properly, the folder name has to be the same as the main mdx file:

If the folder structure were like this, it would work.
Current fix
I've just added in a pretty basic check for anything with 'introduction' as the permalink, and then replaces it with
index.Proper fix
However I think you can fix this properly in
page-generator.ts, where it seems like you've already got a monkeypatch fix?I see the TODO:
And I think the answer is "Nextra does support nested pages at the top level, you just need to call the containing folder
index. At least it works for me (see above). I think my monkeypatch will also somewhat work, but only if the toplevel folder is anintroduction.