Skip to content

03 A Wiki folder structure

mgledhill edited this page Mar 14, 2025 · 6 revisions

PAL Logo showing Wiki Documentation heading

3SpacerA Wiki folder structure

It is perfectly possible to impose a folder structure on a GitHub Wiki, but it is not possible to do so from within GitHub itself. It must be done in a local repository (I use VS Code as my editor) and the folders then pushed back to GitHub.

It should be noted that GitHub largely ignores any applied folder structure, it will list any markdown files (files ending .md) in its contents (pages) area and allow them to be accessed without referring to the folder structure (see section 9.8). Other files need to be referred to (as a minimum) with the full path from the root directory of the Wiki (I.e. all folders and subfolders that follow the ${\large \color{#446FBD}\text{/}\color{#c00000}\text{wiki}}$ directory).

The big advantage to using a folder structure is that it allows different sidebars and footers for the pages in each subfolder (see section 4).

⬆️ Top



3.1SpacerThe default arrangement

By default, any page created by GitHub in a Wiki will be in the repository folder:

     ${\large \color{#7030A0}\text{https:/}\text{/github.com}\color{#446FBD}\text{/}\color{#ED7D31}\text{[UserName]}\color{#446FBD}\text{/}\color{#00B050}\text{[RepositoryName]}\color{#446FBD}\text{/}\color{#c00000}\text{wiki}}$

In the case of this Wiki being discussed here, it is in:

     ${\large \color{#7030A0}\text{https:/}\text{/github.com}\color{#446FBD}\text{/}\color{#ED7D31}\text{practicalseries}\color{#446FBD}\text{/}\color{#00B050}\text{GitHub-Wiki-Design-and-Implementation}\color{#446FBD}\text{/}\color{#c00000}\text{wiki}}$

Entering the above link in a web browser will take you to the Home page of the Wiki.

Wiki Home page
Figure 3.1 — The Wiki Home page

In actuality, the link should be:

     ${\large \color{#7030A0}\text{https:/}\text{/github.com}\color{#446FBD}\text{/}\color{#ED7D31}\text{practicalseries}\color{#446FBD}\text{/}\color{#00B050}\text{GitHub-Wiki-Design-and-Implementation}\color{#446FBD}\text{/}\color{#c00000}\text{wiki}\color{#446FBD}\text{/}\color{#FF0000}\text{home}}$

Tip

The reason it is not necessary to use the home addition is that the GitHub Wiki server knows that if no page is specified, it will default to the home page. This is similar to a website not having to specify index.html in their base URL.

To link to another page, the name of the page must be included:

     ${\large \color{#7030A0}\text{https:/}\text{/github.com}\color{#446FBD}\text{/}\color{#ED7D31}\text{practicalseries}\color{#446FBD}\text{/}\color{#00B050}\text{GitHub-Wiki-Design-and-Implementation}\color{#446FBD}\text{/}\color{#c00000}\text{wiki}\color{#446FBD}\text{/}\color{#FF0000}\text{11-images}}$

The above will link to the ${\large \color{#446FBD}\text{Images}}$ page of this Wiki (note, if any spaces are in the name they must be replaced with a dash).

In all cases, it is not necessary to specify the .md extension, GitHub will figure this out .

In fact, if the .md extension is added, GitHub will not find the file (I think it adds .md to the filename and is now trying to find a file that ends .md.md and it can’t).

If all the Wiki pages were built using GitHub and if that Wiki repository were copied to a local machine, everything would be in one directory, like this:

Default GitHub folder
Figure 3.2 — The default GitHub folder arrangement for a Wiki

⬆️ Top



3.2SpacerCreate a sidebar or footer locally

This is a slight aside from the folder structure, but is necessary to explain how the folder structure impacts the sidebar and footer (in particular how it impacts individual sidebars and footers for different Wiki pages).

If there were no sidebar or footer created using GitHub, the _sidebar.md and _footer.md files will not be present in the root folder.

It is possible to create sidebars and footers in a local copy of the Wiki and then push them to GitHub. All that is required is that either or both the _sidebar.md and _footer.md files are created locally in the root directory (where the Home.md file is), the files must have some content.

A typical example of the _Sidebar.md file for this Wiki is shown below (in VS Code):

Editing a sidebar
Figure 3.3 — Editing a sidebar in VS Code

The above code renders like this (the bit you can see in the listing above is the navigation bar at the top of the image below):

Rendered sidebar
Figure 3.4 — Rendered version of the sidebar

Creating or changing these files within VS Code and pushing the changes to GitHub will change the common sidebar and footer used by all pages.

A full discussion of sidebars and footers and their contents is given in section 16.6 and section 16.7 (these relate to how they are constructed for the PracticalSeries Wiki pages).

⬆️ Top



3.3SpacerPage naming and Wiki limits

Before starting the folder structure, it is worth examining the page naming conventions used in the PracticalSeries Wikis. These to some extent determine the folder names that will be used in the Wiki folder structure.

It is also worth knowing the limits that GitHub imposes on Wikis and the files that can be included.

3.3.1SpacerSupported file types

Wiki content pages are generally Markdown files (.md), virtually all Wiki pages are Markdown files, but other filetypes are supported and show up in the GitHub generated contents area. The following file types are supported for page content:

Page Content Language File extension
Markdown (default format for a Wiki) .md
AsciiDoc .asciidoc
Creole .creole
MediaWiki .mediaWiki
Org-mode .org
Pod .pod
RDoc .rdoc
ReStructuredText .rest
Textile .textile
Table 3.1 — Wiki page content file types

Important

Plain text .txt files and rich text files .rtf are not supported as page content platforms and will not appear in the contents area.

GitHub supports these common image files:

Image file File extension
AV1 (Alliance for Open Media Video) .avif
BMP (Bitmap) .bmp
JPEG (Joint Photographic Experts Group) .jpg or .jpeg
PNG (portable network graphic) .png
GIF (graphic interchange format) .gif
PSD (Photoshop document file) .psd
SVG (scalable vector graphic) .svg
WEBP (web picture format) .webp
Table 3.2 — Wiki page renderable image formats

GitHub supports these common video files:

Video file File extension
MP4 (Moving Picture Experts Group 4) .mp4
MOV (QuickTime movie format) .mov
WEBM (web movie format) .webm
Table 3.3 — Wiki page recognised video formats

Important

Video files themselves cannot be played within a Wiki page, however, the formats are recognised as video files and file size limits are adjusted accordingly (see Section 3.3.4).

⬆️ Top



3.3.2SpacerPage names and numbering

There are two things of importance when naming pages, the first is that GitHub always displays the page filename name at the top of the Wiki page, point ① below:

Page name
Figure 3.5 — Page name displayed at top of a Wiki page

The second point is that the page filename is also listed in the GitHub generated Pages section (effectively a contents list), point ②.

The first point isn’t particularly serious, but the name should match the first heading on the page (in this example: Execution of Controller software).

The second point is more problematic and was touched upon in Section 1.5.2.

The order of the pages in the Pages area is listed in alphanumeric order (based on the ASCII table https://www.ascii-code.com/ to those of a certain age, or nowadays the Unicode table https://www.unicode.org/charts/charindex.html💠1).

This means that if pages were numbered directly with chapter, section and division then the following pages:

     ${\large \color{#1F883D}\text{5.5\ The\ fifth\ section\ in\ chapter\ five}}$

And

     ${\large \color{#1F883D}\text{5.10\ The\ tenth\ section\ in\ chapter\ five}}$

Would appear in the Pages area as:

Pages in wrong order
Figure 3.6 — Pages listed in the wrong order

I.e. the ${\large \color{#1F883D}\text{5.10\ Section}}$ appears before the ${\large \color{#1F883D}\text{5.10\ Section}}$. GitHub puts them in the wrong order.

It’s even worse if there are no section numbers and the pages are just given a title. Under these circumstances the pages will appear in alphabetical order and this is probably not the order that is required.

To get round this problem chapter, section and division numbers must always be two digits and leading zeros must be used where necessary. This can be seen in the following example:

Pages in right order
Figure 3.6 — Pages listed in the right order

All pages within the PracticalSeries Wikis are given chapter, section and division numbers (with the exception of the Home page and some other special pages).

While it is necessary for the filenames to start with the chapter, section and division numbers (with leading zeros), any manually configured contents list (that links to these files) can show the abbreviated number (without leading zeros). The following diagram shows the numbering structure for the first two chapters of the this Wiki:

Wiki contents
Figure 3.8 — Contents list for a Wiki

The numbering is always in the format:

     ${\large \color{#1F883D}\text{Chapter.Section.Division}}$

Thus, ${\large \color{#1F883D}\text{1.5.2\ Contents\ area}}$ is division 2, of section 5 in chapter 1.

The corresponding page filename would be

     ${\large \color{#1F883D}\text{01.05.02\ Contents\ area.md}}$

The rules for these naming conventions are given in the following section:

⬆️ Top



3.3.3SpacerRules for page numbering

The chapter, section and division numbering of pages within the PracticalSeries Wikis is important, it affects how the folders for each page are numbered in the Wiki folder structure. The following are the rules for page numbering:

 ❶   Always use a numbering structure:
  •   Chapter number only for small Wikis Cc
  •   Chapter and section Cc.Ss or
  •   Chapter Section and division Cc.Ss.Dd
 ❷   Pages that start at a **chapter** should be named:
  •   Cc Chapter title text.md
 ❸   Pages that start at a **section** should be named:
  •   Cc.Ss Section title text.md
 ❹   4 Pages that start at a **division** should be named:
  •   Cc.Ss.Dd Division title text.md
 ❺   Cc, Ss and Dd must always be two numerical digits
 ❻   Leading zeros must be used where necessary
 ❼   Ss and Dd must always preceded by a full stop character (.)
 ❽   The title text must be separated from the last numerical digit with a space character
 ❾   The title text (the .md filename) must be correctly capitalised
 List 3.1 — Rules for page numbering

Important

This structure only caters for chapter, section and division numbers in the range 0-99. This should be more than adequate for most document.

⬆️ Top



3.3.4SpacerLimits for Wiki pages

There are some absolute limits for the size of Wiki pages, generally, these are quite liberal and are unlikely to cause problems. These limits are:

 ❶   A Wiki can have a maximum of 5000 files within it (of any type)
 ❷   A Wiki page can have a maximum of 484,044 characters
 ❸   The maximum size for a Wiki page (.md file) is 0.5 MB
 ❹   The maximum size for images and videos is 10 MB
 ❺   The maximum size for any other file is 25 MB (pdfs, docs &c.)
 ❻   Files over 100 MB cannot be uploaded
       List 3.2 — Wiki page file size limits

The largest files within the Wiki associated with this document are some of the character tables in the Appendices (the largest is Appendix B.2 and the .md file is 501 kB, just less than the 512 kB or 0.5 MB limit). These all work, but occasionally, GitHub generates an error saying the page takes too long to render (reloading the page usually works).

The above limits do not generally cause any problems with Wiki pages (you are unlikely to hit any of them). With the PracticalSeries Wiki pages, other restrictions are imposed to manage page lengths and the splitting of text in to individual Wiki pages.

The rules for how chapters, sections and divisions are split into Wiki pages is fairly arbitrary and generally depends on the resultant length of the Wiki page.

All PracticalSeries Wikis use the chapter, section, division numbering Cc.Ss.Dd, In practice, the vast majority of PracticalSeries Wiki pages start at the chapter level (each page “mostly” starts at a new chapter). For very long chapters, the pages break at the section level. There are no breaks at the division level.

To give some idea of the (very) rough rules of thumb employed on PS Wiki pages, the following conditions are applied:

 ❶   Limit the number of lines on a page to a maximum of 500
 ❷   Limit the number of words on a page to a maximum of 4000
 ❸   A new Chapter must always start on a its own Wiki page
 ❹   If splitting a chapter do so at a new section
 ❺   Avoid starting new pages at the division level
 ❻   A new page can start with a new division, but only when absolutely necessary
 ❼   Never start a new Wiki page with an inline (unnumbered) heading
 ❽   Never start a new Wiki page in the middle of body text
       List 3.3 — Guidelines for Wiki pages

⬆️ Top



3.4SpacerA Practical Wiki folder structure

The default GitHub arrangement may be enough for small Wikis, but it is not sufficient for more complex Wikis like the PracticalSeries (PS) Wikis. These contain quite comprehensive sets of documentation and need a little more sophistication than is provided for with the basic GitHub structure. To do this, each Wiki page is stored in its own subfolder.

The mechanism described here is the one used throughout the PracticalSeries Wiki pages. It can be applied or adapted to any other GitHub Wiki

These are the principal reasons for using a folder structure within a Wiki:

 ❶   It allows each page to have its own, individual sidebar and footer
 ❷   It allows the pages to be better organised
 ❸   Each page subfolder has its own folders for images and data
       List 3.4 — Reasons for using a folder structure

In the case of this Wiki GitHub Wiki — Design and Implementation, only the Home page, a common logo image and the home page sidebar and footer is in the root directory of the Wiki repository:

All the other pages are in their own subfolder.

This page, for example, has the filename 03 A folder structure for a Wiki.md and is in the folder 03-0000.

It can be seen here in VS Code:

Wiki subdirectory
Figure 3.9 — A Wiki page subdirectory

⬆️ Top



3.4.1SpacerSubfolder names for Wiki pages

Each PS Wiki page is stored in its own subfolder. The subfolder is simply a number in the format:

Cc-SsDd

Where Cc is the chapter number, Ss is the section number and Dd is the division number (all with leading zeros where required).

Thus, a Wiki page subfolder is made up of the chapter, section and division number of the first heading on the page. If it is a new chapter, then Ss and Dd will be zero, i.e.:

     ${\large \color{#446FBD}\text{Cc-0000}}$

Thus, if a Wiki page starts at chapter 3, it will be in subfolder:

     ${\large \color{#446FBD}\text{03-0000}}$

If a page were to start at chapter 4, section 2 it would be in subfolder:

     ${\large \color{#446FBD}\text{04-0200}}$

If a page were to start at a Division, say chapter 11, section 12, division 15; it would be stored in subfolder:

     ${\large \color{#446FBD}\text{11-1215}}$

Tip

Starting pages at a division is not recommended and is generally avoided on the PracticalSeries Wiki pages — it’s there if you need it, but try not to do it.

The folder structure also accommodates Appendices. Appendices are numbered with a letter (A-Z) in place of a chapter number, the sections and divisions within an appendix are numbed in exactly the same was as normal chapters.

The folder name for Appendix B, would be:

     ${\large \color{#446FBD}\text{B-0000}}$

There is no need to put a leading zero before the appendix letter (these will automatically fall into the correct alphabetical order). This arrangement accommodates up to 26 appendices (A to Z), if more than this are required, it is better to us a numerical structure for appendices.

The folder structure for this Wiki looks like this (at the time of writing):

Wiki folder structure
Figure 3.10 — A typical example of the Wiki folder structure

Files for each Wiki page are stored in the specific folders. This can be seen in the following image (page files are shown in orange, the individual subfolders in white and the root folder is highlighted in blue. The individual sidebar files are in purple and the individual footer files in dark blue):

This Wiki folder structure
Figure 3.11 — This Wiki folder structure

⬆️ Top



3.4.2SpacerStoring images and other data

Images and data for a particular page are stored in two separate folders within the subfolder for a particular page, this can be seen here:

Storing images and data
Figure 3.12 — Storing images and data

Figures are stored in a subfolder called:

     ${\large \color{#446FBD}\text{02-images}}$

And any data files are stored in

     ${\large \color{#446FBD}\text{04-data}}$

It can be seen in Figure 3.12 that there are three .png images stored for the page:

     ${\large \color{#446FBD}\text{01\ Introducing\ the\ GitHub\ Wiki.md}}$

The ${\large \color{#446FBD}\text{04-data}}$ folder is to store any other type of file that may be linked to a particular page (a pdf file in this case).


Footnotes:     


Note

💠1 If there is a worse website than the Unicode website I’d like to see it. It has a Circa 1989 feel, it’s impenetrable and virtually useless. If Tim Berners-Lee had seen it, he would have given up on the World Wide Web there and then.




Wiki contentsSpacer

Previous page Previous chapter Home Next chapter Next page
   Home

       The GitHub Wiki
       What does this guide cover?
       A note by the Author

     CaseNotes

   Licence

       The licences and other details
       The Licence
       Why did I choose the MIT Licence?
       Permissive licences
       Copyleft licence
       Limiting liabilities
       Which licence to use?
       A note on spelling: licence or license

1    Introducing the GitHub Wiki

   1.1      What are GitHub Wiki pages?
   1.2      Understanding the Wiki pages
   1.3      Creating a Wiki for a repository
   1.3.1     Creating the first Wiki page
   1.3.2     Creating additional pages
   1.3.3     Editing a Wiki page
   1.4      The Wiki is its own repository
   1.4.1     Viewing a Wiki page history
   1.4.2     How GitHub handles Wiki branche
   1.4.3     The Wiki link to the main repository
   1.5      Basic components of a Wiki page
   1.5.1     Title bar and revision
   1.5.2     Contents (pages) area
       Listing pages in the order you want
   1.5.3     Sidebars
   1.5.4     Footers
   1.6      Sidebars and footers
   1.6.1     Creating a sidebar and footer

2    Cloning a Wiki

   2.1      Why clone a Wiki?
   2.2      How to clone a Wiki
   2.3      Pushing local changes to GitHub
   2.3.1     Configuring username and email
   2.3.2     Modifying the local repository
   2.3.3     Committing and synchronising

3    A Wiki folder structure

   3.1      The default arrangement
   3.2      Create a sidebar or footer locally
   3.3      Page naming and Wiki limits
   3.3.1     Supported file types
   3.3.2     Page names and numbering
   3.3.3     Rules for page numbering
   3.3.4     Limits for Wiki pages
   3.4      A Practical Wiki folder structure
   3.4.1     Subfolder names for Wiki pages
   3.4.2     Storing images and other data

4    Different sidebars and footers

   4.1      How sidebars work
   4.1.1     The PracticalSeries sidebar
   4.2      How footers work
   4.2.1     The PracticalSeries footer

5    Markdown, GitHub Markdown and HTML

   5.1      Some useful Markdown sites
   5.2      An overview of Markdown
   5.3      How Markdown works
   5.4      Markdown flavours
   5.4.1     GitHub Flavoured Markdown (GFM)
   5.5      HTML and Markdown
   5.5.1     HTML with GFM
       GFM blacklisted HTML tags
       GFM whitelisted HTML tags
       GFM HTML tags - the grey area
       GFM whitelisted HTML attributes
   5.5.2     PracticalSeries and Markdown
   5.6      Markdown difference between files

6    Basic Markdown and text formatting

   6.1      Body text and fonts
   6.1.1     Body text responsive design
   6.1.2     Body text in sidebars and footers
   6.1.3     Rules for body text
   6.1.4     Body text examples
   6.1.5     Alignment of Body text
       Left aligned text (default)
       Right aligned text
       Centred text
       Justified text
   6.1.6     Body text propertie
   6.2      Paragraphs and line breaks
   6.2.1     Forced line break
   6.2.2     Blank line and a line break
   6.2.3     Trailing space line break
   6.2.4     Paragraph and line break rules
   6.2.5     Paragraph and line break examples
   6.3      Horizontal line
   6.3.1     Rules for horizontal lines
   6.4      Emphasis with bold
   6.4.1     Rules for bold
   6.4.2     Bold text examples
   6.5      Emphasis with italics
   6.5.1     Rules for italics
   6.5.2     Italic text examples
   6.6      Emphasis with bold and italics
   6.6.1     Rules for bold and italics
   6.6.2     Bold and italic text examples
   6.7      Emphasis with underlining
   6.7.1     Rules for underlining
   6.7.2     Underlining text examples
   6.8      Emphasis with strikethrough
   6.8.1     Rules for strikethrough
   6.8.2     Strikethrough text examples
   6.9      Superscript and subscript
   6.9.1     Rules for superscript and subscript
   6.9.2     Superscript and subscript examples
   6.10    Headings
       Alternatives for heading 1 and 2
   6.10.1   Headings Markdown rules
   6.10.2   Heading properties

7    Special characters and escaping characters

   7.1      Escape characters and codes
   7.1.1     Markdown escape sequences
   7.1.2     HTML escape sequences
   7.1.3     Decimal and hexadecimal codes
       Hexadecimal escape codes
   7.2      Special space characters
   7.2.1     Escape sequence restrictions
   7.3      Emojis and emoticons
       A note by the Author about emojis
   7.4      Comments

8    Block quotes, lists and alerts

   8.1      Block quotes
   8.1.1     Nested block quotes
   8.1.2     Adding other elements
   8.1.3     Rules for block quotes
   8.2      Unordered (unnumbered) lists
   8.2.1     Nested unordered lists
   8.2.2     Type of bullet point
   8.2.3     Indents and spacing
   8.2.4     Numbers in an unordered list
   8.2.5     Adding paragraphs
   8.2.6     Adding other elements
   8.2.7     Rules for unordered lists
   8.3      Ordered (numbered) lists
   8.3.1     Starting at a different number
   8.3.2     Nested ordered lists
   8.3.3     Type of numbering
   8.3.4     Indents and spacing
   8.3.5     Adding paragraphs
   8.3.6     Adding other elements
   8.3.7     Rules for ordered lists
   8.4      Mixing ordered and unordered lists
   8.5      Task lists (check boxes)
   8.5.1     Nested task lists
   8.6      Alerts
   8.6.1     Rules for alerts

9    Links

   9.1      Link to an external web page
   9.1.1     A direct link to a URL
   9.1.2     A link using substitute text
   9.1.3     A link using tooltips
   9.2      Link to another page in the Wiki
   9.2.1     Rules for linking to a Wiki page
   9.3      Link to headings on current page
   9.3.1     Converting a heading to a link
   9.3.2     An example of a heading link
   9.3.3     Heading link with tooltips
   9.4      Link to headings on a different page
   9.4.1     An example of a heading link
   9.5      Link to a named element
       A note by the Author
   9.5.1     Link to a point on another page
   9.6      Downloading a file
   9.6.1     The download attribute
   9.6.2     Spaces in filenames
   9.6.3     Downloading a .md file
   9.7      Reference style links
   9.8      Relative links
   9.8.1     Relative links from any Wiki page

⬇️ End of page
Clone this wiki locally