The HTML file created in 1c. was renamed to index.html
, so we have a few options for updating the link:
1. Use the full URL in the href
attribute.
<a href="https://[your_github_username].github.io/[your_repository_name]/index.html">Link</a>
2. Don't specify a file at the end of the url and it will default to opening index.html
.
<a href="https://[your_github_username].github.io/[your_repository_name]">Link</a>
3. Use a filepath to link to index.html
.
<a href="index.html">Link</a>
4. Use a filepath, but leave out the filename.
<a href=".">Link</a>
Note: you might think that if we leave out the file name from <a href="index.html">Link</a>
, it will be <a href="">Link</a>
. However, in HTML href=""
will cause the link to not do anything. Therefore, we use href="."
.
is a special character that represents the folder that the current HTML file (with the link) is in.
And because we don't specify a file name after .
, it will default to opening index.html
in the current folder.
We will learn more about .
when we learn about the command line.
Option 4 above is the preferred option because it's the easiest to type and won't break if the first part of the URL (https://[your_github_username].github.io/[your_repository_name]
) changes.