41

I don't seem to be able to give a sort order to the Wiki pages of a project on GitHub. Does this option even exist?

GitHub pages screenshot

BrechtDeMan
  • 6,589
  • 4
  • 24
  • 25
tocqueville
  • 5,270
  • 2
  • 40
  • 54

3 Answers3

37

It does not.

But you can use the side bar to make a custom 'table of contents' where you can put them in any order you want, with headings and everything, see below (from https://github.com/BrechtDeMan/WebAudioEvaluationTool/wiki)

You may want to have a look at the answers to this question.

enter image description here

Community
  • 1
  • 1
BrechtDeMan
  • 6,589
  • 4
  • 24
  • 25
  • Going to the wiki linked in this answer and clicking on the small `Edit` tool (the small pen) gives a concrete example of how to write your own file. – Eskapp Dec 28 '18 at 22:26
18

Another approach is to prepend numbers in front of your page titles.

1. Home
2. Installation
3. Domain
4. CmsMethods
Kevin Workman
  • 41,537
  • 9
  • 68
  • 107
  • 4
    @affhendrawan Then prepend zeroes: `01`, `02`, `03`, etc. But really this is just a quick and dumb approach for simple use cases. – Kevin Workman Oct 27 '18 at 15:47
  • 2
    This is a good solution for simple wiki's, however keep in mind that when you want to add a new page number 2 and rename page 2 to 3, 3 to 4, etc. That the links of you wiki pages change. So all links to these pages break – Niek Nijland Oct 22 '19 at 15:02
3

You could use the github-wiki-sidebar npm module to enforce an order of the pages and also generate the sidebar menu.

  • install the npm module locally

    npm install github-wiki-sidebar -g
    
  • clone your wiki repository

    git clone <https://github.com/<username>/<my-project-name>.wiki.git
    cd <my-project-name>.wiki
    
  • execute the tutorial action with --git-push flag

    github-wiki-sidebar --action=tutorial --git-push
    

Leave the default options for all the queries besides the ordering. Here a list of all your files will be displayed with the option to change the default order. You can check an example below from the module's documentation:

enter image description here

In the end, your GitHub wiki sidebar is updated as the --git-push command will also commit your changes to origin repository. It adds the modified _Sidebar.md file an option.json file to store your options for any following updates.

adtanasa
  • 89
  • 4