grapeporcupine
grapeporcupine

Reputation: 77

Github Pages Subdirectory Files Not Showing Up

I have a repository with an index.html file and subfolders containing other html files. The repository name is "parent-folder" and the repository contains "subfolder1", "subfolder2", etc.

Within the index.html, the code has links to the subfolders as, for example,"/subfolder1/subfolder1.html"

I put the repository up onto github pages so that I can access the index.html file as .github.io/parent-folder, but when I click the links on the page that are supposed to bring me to the subfolder1.html, it brings me to a 404 pages. I also have subfolders that contain images that I reference in index.html, which also do not show up.

How should I be including the subfolder references in my index.html?

Upvotes: 1

Views: 1490

Answers (1)

VonC
VonC

Reputation: 1324033

You can try:

  • either relative URLs:

    <a href="./subfolder1/aFile">SubFolder1</a>
    
  • or absolute URLS:

    <a href="https://github.io/parent-folder/subfolder1/aFile">SubFolder1</a>
    

But consider also using GitHub Action to publish your site, using one of the starter packs.


The OP grapeporcupine adds in the comments:

My issue was that I was not including the "." and ".." to reference the subfolders

Upvotes: 1

Related Questions