Github Pages opens my read me instead

I noticed that recently when I created a github page website for my repos, that the code wasn’t compiled to give the design of the website but it instead showed the readme of those files.

I have two repos, we the issue recently;


And these are my most recent uploads and I also tried opening them with my netlify account but I still got an error.

Hello @Fedozie, welcome to the GitHub Support Community!

For your HTML pages to display at the root of the directory, you’ll want to name them index.html (all lowercase). They’re currently served from the file itself:

Renaming LengthConverter.html and dicee.html to index.html should fix it.

Since they’re purely HTML, I’ll also recommend creating an empty file named .nojekyll in the root of the repo to disable jekyll processing.

And if you’d like to preserve the documents’s names in the repository (for end users’ sake) you could then create a copy renamed to index.html of these HTML documents in the docs/ subfolder (also copying the CSS and JS assets into it) and change the repository settings for GH Pages to serve website contents from the docs/ subfolder instead of the root folder — this way you’ll be able to keep the custom filenames and also show them as the GH Pages home page.

You could add a shell script to carry out the copy and rename operations to automate the process, making it easier to keep the copies in synch with the original files, whenever you update the sources.

Furthermore, if you wish that end users downloading the project via the download button shouldn’t receive the redundant docs/ folder, but only the main files in the project root, you could exclude the folder and its contents from the generated Zip archive by adding an export-ignore rule in the .gitattributes file:

docs/** export-ignore
1 Like