Home > Software design >  Home icon won't work after uploading project to GitHub
Home icon won't work after uploading project to GitHub

Time:11-21

First time uploading a project I am doing for my course on GitHub. Everything works fine when working in VSCode but after uploading to GitHub and adding to GitHub pages, I get a 404 error when trying to navigate back using the home icon. How can I fix this??

<body>
    <a href="docs/index.html">
    <svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" fill="rgb(254, 232, 194)" id="house" viewBox="0 0 16 16">
        <path d="M8 6.982C9.664 5.309 13.825 8.236 8 12 2.175 8.236 6.336 5.309 8 6.982Z"/>
        <path d="M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.707L2 8.207V13.5A1.5 1.5 0 0 0 3.5 15h9a1.5 1.5 0 0 0 1.5-1.5V8.207l.646.646a.5.5 0 0 0 .708-.707L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.707 1.5ZM13 7.207V13.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V7.207l5-5 5 5Z"/></svg>
    </a>

This is the current code I am using that works within VSCode.

I was thinking of copying the link from within the GitHub Pages but not really sure If this would work.

First project so definitely confused on this and would love some feedback.

CodePudding user response:

Does the URL structure in GitHub Pages match what you're working with in VS Code? It looks like you are linking to an index page in a subfolder called "docs" in VS Code based on the code you provided.

<a href="docs/index.html">

So, looking at your GitHub Pages site structure, does that index file live at the root level of your project directory or is it still within the "docs" folder?

If it is within "docs", for example: https://yourusername.github.io/docs/ then try the following link:

<a href="/docs/">

Or if it's at the root level, for example: https://yourusername.github.io/ then you could try the following link:

<a href="/">
  • Related