HUGO

Possible to render file without extension as html?

I would like it to render the file as html if I access mysite.com/file, instead of plain text file it is now.

Or alternatively render the file.html if we access /file, if possible?

Thank you!

Hi @CyberMew ,

You may find a solution in the Gitlab forum

Thanks @iaeiou , any idea which solution is applicable for Hugo? One of it says it is already enabled for GitHub Pages (which we are not using), and the rest are for GitLab Pages it seems.

The file I have is purely a html file and I just want to host it together with Hugo, so it is inside the /content folder. As per How to remove HTML extension from GitHub Pages in 0 easy steps - by Rafał Pocztarski, I would like to access the file without a trailing ‘/’ too.

Why would you want to remove the extension and a trailing slash? To do that you’ve have to have to use a re-write, which is a pretty expensive operation if done for every request, you’re just going to slow down every server response. I’m curious why you would want to do that.

I have a requirement where a fixed path is called. I can only change the domain, so the app is calling like site.com/callback/verify?id=123. I only need it for this certain file, and it’s temporary for my current project. It is a standalone file. I can either name the file verify or put it inside a folder call verify/index.html as long as it works.