`hugo server` should check for /foo.html when requesting /foo #2242
Comments
@anthonyfok Hey I'm interested in doing this myself, but I don't have much experience with golang. or hugo. Would you mind giving me a pointer as to where to start? |
@octref this issue is in the category of "we should most likely not do this", and if so only if it is really simple and someone is providing a finished solution for it. Teaching you Golang doesn't fit that bill. |
@bep I understand that. Just want to know where to start. Guess I'll look into https://github.com/spf13/hugo/blob/master/commands/server.go and how Just wondering, is it that you are against this feature?
|
Knowing "we should most likely not do this" is useful as I can possibly avoid the awkward situation where I take time to do a PR and you don't want this feature at all. Also saw your comment at #874:
So as for approach to this problem:
|
Guess I'll should switch back to jekyll. |
I'm not sure I understand this feature request. Is it that you want the page URL to be /a/ but you want the filename to be /a.html instead of /a/index.html so your provider will do redirects? If so, there's no need to adjust Hugo. Just write a script (could be in any language, doesn't have to be Go) to move /a/index.html to /a.html after you've done a build with Hugo, since it's really about the final file locations, not the URL as Hugo understands them. |
I'm using https://surge.sh/ to deploy my hugo site. It has a great clean url feature, so if you have
/foo.html
,/foo
will get it,/foo/
will redirect to/foo
.So now I'm creating
content/foo.md
, and enablinguglyurls
so hugo generates/foo.html
.In some pages, such as listing page, I'm now using
{{ trim .RelPermalink ".html" }}
to use clean url in href. However, this causes problem with hugo server. A request of/foo
doesn't check the existence of/foo.html
, but directs to/foo/
to try/foo/index.html
immediately.The text was updated successfully, but these errors were encountered: