Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternate de-uglified URLs, as "/file" (no extension), with "/dir/" (with trailing slash) only for directory-like pages #7458

Closed
chrish42 opened this issue Jul 4, 2020 · 5 comments

Comments

@chrish42
Copy link

chrish42 commented Jul 4, 2020

For me, what looks cleanest for a website's URL structure is when the leaf pages are mapped to /some-file (no trailing slash) but without a .html extension, and /foo/ is used only for pages that are directory-like. For me, this is the cleanest design for URLs. This works really well together with hosting on a S3, etc. bucket, where you can push metadata to set the correct content-type when there is no extension for the file.

I'm willing to do the work and create a pull request to support this, but before I start coding, it'd like to gauge the openness to such a change, so as to avoid doing all the work to then have it rejected as not a desirable feature.

For Hugo, this would mean:

  1. An alternate way of "de-uglifying" URLs that uses /foo/ only for "directory-like" pages, but that...
  2. Keeps note of the content-type of files where the extension is stripped (so we can pass those to the program that uploads to the S3, etc. bucket) and create a content-type map file with this info, optionally
  3. And a config switch to access this new functionality.

An alternate way for point 2 might be to restrict /foo only for HTML pages (likely what will happen in practice anyways) and then any extension-less file can be assumed to be one. Also, for some tools, the content-type map may not be even needed. At least for GCP, gsutil has a mode that auto-detects content-type from the content of the file. I'm guessing it has no problem at all figuring out which files are HTML (from the <!HTML ...> header.

Thoughts? Is this something that Hugo would consider supporting, if a pull request implementing this were to magically appear? :-)

@github-actions
Copy link

github-actions bot commented Mar 8, 2022

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@github-actions github-actions bot added the Stale label Mar 8, 2022
@chrish42
Copy link
Author

Still relevant for me, given the multiple times this has been requested, etc.

For this to work, it needs to be combined with something with something that sets the right mime-type on the extension-less files uploaded for the webpages, so it needs some support from the webserver and shouldn't be the default behavior. But, at least for folks using static hosting on AWS, GCP, etc., support for per-file mime-types is built-in. I feel like it would be a nice addition.

Basically:

  • Upload directories as directories, files as files, according to the URL path.
  • At least for the files intended to be accessed by users directly via a URL, they are uploaded without an extension, but with their mime-type set correctly.

@github-actions github-actions bot removed the Stale label Mar 13, 2022
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants