I have a static website hosted on GitHub Pages and I am trying to remove the .html extension from the URL.
I understand that when using Jekyll, there is something called Permalink to do so. The thing is that I am not using Jekyll but only pure HTML & CSS.
I've also tried to create an .htaccess file at the root of my folder, but it doesn't seem to work on GitHub Pages.
I only have three html pages: index.html, projects.html and about-me.html.
When redirecting to the index.html, I can write <a href="/"></a>
and then it'll remove the .html from the URL, but that's only specific to the index.
Any other way to do it for the other html pages?
It already works and you don't have to do anything I'm not sure if you are already aware of that or not but to remove .html extension from GitHub Pages all you have to do is remove .html extension from your links.
In other words it already works and you don't have to do anything. You don't have to use subdirectories, CNAME, redirects, Jekyll _config.yml, YAML front-matter or any other hack.
For example you can use:
https://rsp.github.io/gh-pages-no-extension/test1 instead of:
https://rsp.github.io/gh-pages-no-extension/test1.html and it displays the same file. Just change the links in your links and that's it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With