Linking files into folders

Hello, I am fairly new to GitHub, and I am trying to link a file into my index.html folder, such that there will be a way to access my README.md file from a link on my index page. Can someone please walk me through the steps of how to accomplish this? If someone could, that would be great.
Below is my README.md file link: https://github.com/JosephGallagher2001/JosephGallagher2001.github.io/blob/master/README.md
Best, JosephGallagher2001

Hi, @JosephGallagher2001!

Before I can answer your question about creating links, it’s important to clarify some details about how GitHub Pages publishes files, particularly README.md and index.html.

An important detail about README.md and index.html

When you publish a repository as a GitHub Pages site, the GitHub Pages build process converts Markdown files to HTML, for viewing on the web. These converted files aren’t stored in your repository, as they only exist as part of your published website. Any HTML files in your repository are not converted. Instead, they are published exactly as-is.

For example, if you had a Markdown file in your repository named about.md, GitHub Pages would convert it to HTML and publish it at JosephGallagher2001.github.io/about.html.

If you had an HTML file in your repository named blog.html, GitHub Pages would publish it as-is, at JosephGallagher2001.github.io/blog.html.

As you can see, the published URL for a page generally matches its filename, with .md becoming .html. There is, however, an exception to this rule: GitHub Pages will not publish README.md as README.html, but rather as index.html. It does this because index.html is an accepted standard for a site’s default landing page, and README.md commonly serves a similar purpose on GitHub.

Your repository contains both a README.md file and an index.html file. This presents a conflict, as GitHub Pages is designed to publish both files as index.html. Under these circumstances, the index.html file in your repository takes precedence, and GitHub Pages skips the process of converting your README.md file to HTML.

All of this is to say that you can’t create a link between an index.html file and README.md, due to the unique publishing conflict relevant to these files. You can, however, create links between any other files in your repository.

Okay, now we can talk about links!

As an example, let’s say you modified your repository to contain two Markdown files: index.md and about.md. To link from the first to the second, you can use this syntax:

[Click here to visit my about page!](about.md)

GitHub Pages will then convert these Markdown files to HTML, publishing them as index.html and about.html. In this process, it will convert the above Markdown syntax into valid HTML. The HTML syntax for this link would look like this:

<a href="about.html">Click here to visit my about page!</a>

If you want to keep a mix of HTML and Markdown files in your repository, you’ll need to use the HTML syntax when creating links in your HTML documents, and the Markdown syntax when creating links in your Markdown documents. Be careful to note the different file extensions.

I hope that helps! If you have any follow-up questions, please don’t hesitate to ask.

Friday

2 Likes