Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to order files and folders? #3

Open
metasaver opened this issue Jun 4, 2020 · 5 comments
Open

Is there a way to order files and folders? #3

metasaver opened this issue Jun 4, 2020 · 5 comments

Comments

@metasaver
Copy link

  1. At the root level, I would like to move an Introduction page to above the first folder.
  2. My root level folders are all ordered correctly (Works well)
  3. My sub-folders are not ordered in the way I would like them.
  4. I would also like to put another intro.md file as the first entry

Is any of this possible in the current implementation, I have scoured the example and docs but haven't been able to find anything.

Btw, very nice plugin.

This is my sidebars file - it doesn't throw an error.
image

This is the result. The arrows are where I am trying to get the files to show up (#1 & 4), the order of level 2 is alphabetical, not as in the sidebars.yml
image

Thanks

@ghominejad
Copy link
Contributor

ghominejad commented Jun 6, 2020

Hi @metasaver, The sidebars.yaml file is used for naming, ordering and also hiding the folders but not files. you don't need to define them inside sidebar.yaml. Maybe was better we would name it folders.yaml.

If you want to order files you can add a number to the beginning of the files (in file system).

1.fileX.md
2.fileY.md
3.fileX.md

You can also use negative numbers to display them in reverse order :

-1.fileX.md
-2.fileY.md
-3.fileX.md

You need to put a dot after the number

Hope this helps.

@metasaver
Copy link
Author

-1 seems to work thanks. Btw they werent files but sub folders in my yaml. I was just trying order like this:

file
subfolder
subfolder
subfolder
file

@ghominejad
Copy link
Contributor

ghominejad commented Jun 10, 2020

The order of files and folders are sync together. You can also start from 1

filesystem:

1. file
5. file

yaml file:

subfolder : 2
subfolder : 3
subfolder : 4

@booshnelli
Copy link

@metasaver hey just thought i'd mention i've found lettering the files (instead of numbering) in the filesystem to work a bit better.
like this:

a.bananas.md
b.apples.md

this will successfully put bananas.md on top with apples.md below it, and put them both above all the subfolders.

otherwise to get the same effect with numbers i have to do:

-2.bananas.md
-1.apples.md

anyway just thought i'd share my findings.
really liking this plugin 😊

@ghominejad
Copy link
Contributor

Hi @Boosh511, thanks for your feedback!

I'm glad you found this useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants