Question

How do I write a menu in GitHub Markdown and link to a folder?

Answer and Explanation

Creating a menu in GitHub Markdown and linking to folders requires understanding that Markdown doesn't have inherent menu structures like HTML. You create a navigational effect through hyperlinks.

Key Concept:

GitHub interprets URLs starting with "/" relative to the repository’s root and you use this in Markdown.

Here’s how to write a simple menu with links to folders:

Step-by-Step Example:

1. Create your links: In your markdown document, use standard Markdown link syntax to refer to directories:

- [Folder 1](/folder1/)
- [Folder 2](/path/to/folder2/)
- [Specific file inside a folder](/another_folder/file.md)

2. Breakdown of Example: - `- [Folder 1](/folder1/)`: This line creates a bullet point. The text "Folder 1" will be clickable, and the link goes to a directory called `folder1` inside root of your repository. It's also a recommended to have `/` at the end of folder URL for folder linking. - `- [Folder 2](/path/to/folder2/)`: This will create clickable text link that leads to `folder2` which lives in the sub path `/path/to/`. - `- [Specific file inside a folder](/another_folder/file.md)`: A link that goes directly to the file, note you don't need to add trailing `/`.

Folder and Path Considerations:

- The forward slash `/` character denotes directories or folders in your GitHub repository’s root. - You must write correct relative URLs, so all `/path/to/your/folder/`. If it is the root of the repository then you use `/folder_name/`.

Why It Works:

- GitHub pages understand the forward slash notation as being within your repository and when you create URLs like `/path/to/folder` on `github` this directs properly.

Practical Notes: - The URLs are based on how your repository directories are set up. Always confirm that they are working as they must correspond directly. - GitHub will typically direct you to the index file (`index.md`, `README.md`, `index.html`) or an autogenerated page with a list of the content of the target folder, otherwise they will not link and return error code.

By using these concepts, you are not really creating menu but rather a navigational helper through markdown hyperlinks within the text. The important element to take from here is `/`, always use this leading path in order for links to your directories or root files in github repository to work.

More questions