How do I link pages in GitHub Pages
Asked Answered
G

3

7

Essentially I am trying to link to my my GitHub Pages index.html file to the other files in the repository to make a multi page website.

The URL is correct, I have tried a bunch of ways and I am simply getting no where. The main branch is called home, in it is the index.html file, as well as the other files, see below:

Main Branch is called home

The links inside the html file are:

<li class="masthead__menu-item">
          <a href="https://xxx.github.io/home/research/">Research</a>
        </li>

The file "research" is inside the home branch. I have tried naming it "research.html" I have tried deleteing the "home" from the above link so it directly links to research, see below:

<li class="masthead__menu-item">
          <a href="https://xxx.github.io/research/">Research</a>
        </li>

Nothing seems to work. What am I doing wrong?

Gerbil answered 25/4, 2021 at 2:37 Comment(0)
V
1

Looking at the screenshot and the html you provided, I don't see any *.html extensions following the name of the files you're trying to link to.

For example: try renaming the file "research" to "research.html"

Villus answered 25/4, 2021 at 2:45 Comment(1)
Hi thanks for your comment. I tried what you suggested and it still didnt work.Gerbil
G
7

After hours and hours of trying things, I finally got it to work:

       <li class="masthead__menu-item">
          <a href="xxx.github.io/research.html">Research</a>
        </li>

What I did was to get rid of the "home" and make the page an html file. Thank you iamabdm and minwka!

Gerbil answered 25/4, 2021 at 16:58 Comment(2)
Glad, your problem is solved. Therefore 'xxx.github.io' must be your custom subdomain.Powel
Yes, such noob and silly mistake, but I reached out to you guys and it shook something in the old neurons. It finally worked! Much appreciated!Gerbil
V
1

Looking at the screenshot and the html you provided, I don't see any *.html extensions following the name of the files you're trying to link to.

For example: try renaming the file "research" to "research.html"

Villus answered 25/4, 2021 at 2:45 Comment(1)
Hi thanks for your comment. I tried what you suggested and it still didnt work.Gerbil
P
0

If the file is a html file then the problem is with the address of the URL i.e. https://xxx.github.io/research/ in <a href="https://xxx.github.io/research/">Research</a>.

The last slash is causing the problem. Remove the last slash from the address, i.e. https://xxx.github.io/research and it will be <a href="https://xxx.github.io/research">Research</a>.

Powel answered 25/4, 2021 at 4:18 Comment(1)
Hi, thanks for your insight. I did what you said and it still didn't work.Gerbil

© 2022 - 2024 — McMap. All rights reserved.