How to Create a Multi-page Website #35718
-
|
Hello, this is my first week learning HTML and Github. I've been trying to create a two-page website by including two HTML files in my repo; my index file and a file labeled "second." I've learned that you can link two pages and create a hyperlink by using: < a href="html/second.html">Link to Second Page < /a > (added spaces for clarity). However, when I visit my Github site, clicking the hyperlink results in a 404. How do solve this? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
|
A relative link (one not starting with a URL scheme like <a href="second.html">link text</a>See also: What is a URL?, in particular the Absolute URLs vs relative URLs section. |
Beta Was this translation helpful? Give feedback.
-
|
It's even easier by doing this: |
Beta Was this translation helpful? Give feedback.
-
|
Thanks @airtower-luna and @MitkoVtori for chiming in - love that there are multiple perspectives! |
Beta Was this translation helpful? Give feedback.
<a href="html/second.html">creates a relative link tosecond.htmlwithin a directory calledhtml. If you have the files right next to each other there won't be such a directory, and you don't need it.A relative link (one not starting with a URL scheme like
https://, or a slash/) means always to start looking in the same directory as the file in which the link is. So if the filesindex.htmlandsecond.htmlare in the same directory, this will work:See also: What is a URL?, in particular the Absolute URLs vs relative URLs section.