Regarding the example of instead of hi.html just name the file hi and use the nginx Config “default_type text/html” —- is there an equivalent to this for other webservers (Eg Caddy etc) ? Perhaps it would be cleaner to just create a directory called hi with and index.html?
I usually create a "file filter" instead. Keep the extension as is (hi.html) and then use the try_files directive in nginx to make the server look for files with the same path using .html as an example. It has been a while since I used nginx but it looks something like this:
That's that many static site generator do, use a folder and index.html for "clean urls".
Though personally I would do as the other comment said, keep it hi.html and use try_files or mod_rewrite to handle it. I mean, ask me to set up something like this and I probably would never have though of doing it the way in the article. It just seems weird to me.
I don't understand the benefit of this at all. I've been dropping the ".html" from URls for ages now, not by modifying the filename, but using Apache's MultiViews. Apart from anything else, some tools still benefit from a filename's extension advertising that file's type, even if they shouldn't.
I usually create a "file filter" instead. Keep the extension as is (hi.html) and then use the try_files directive in nginx to make the server look for files with the same path using .html as an example. It has been a while since I used nginx but it looks something like this: