Skip to content

1. Create a new HTML file. For example, create a file called test.html:

<p>A new HTML file</p>

2. Upload this file to the GitHub repository:
Screen Shot 2022-04-11 at 12 00 40 AM

3. Update the index.html of your website and add a link:

<a href="https://[your_github_username].github.io/[repository_name]/test.html">Link</a>

You can also use the following code to link to the new HTML file:

<a href="test.html">Link</a>

The href attribute above (href="test.html") uses a filepath. It follows the same rules as loading CSS files and images:

  • href="test.html" => links to a file called test.html beside the current HTML file that's open in the browser.
  • href="folder1/test.html" => looks inside folder1 for a file called test.html and links to that file.

The 2nd option, using a filepath, is preferred since it's easier to type and it won't break if the first part of the URL (https://[your_github_username].github.io/[repository_name]/) changes.

Released under the MIT License. (dev)