Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove
trailing_slashes
option and support URLs with or without HTM…
…L extensions *TL;DR*: Discharge no longer supports the “directory indexes” format. Configure your static generator to output files however it normally does. Discharge also no longer has an option for configuring “trailing slashes” (a poor name for clean URLs). The option will automatically be removed from your configuration the next time you deploy and Discharge will upload HTML files both with and without extensions—use whichever URL style you prefer! Right now if you want to use the “no trailing slashes” (clean URLs) option, Discharge expects your static HTML files to be structured and named in the “directory indexes” format. The directory indexes format is where an HTML file that would normally be named `projects.html` is structured as `projects/index.html`. Then when Discharge deploys your files to S3, it will lop the `/index.html` part of the filename off, leaving just `projects`. This lets S3 serve the `projects` file when a request comes in for the path `/projects`. In retrospect, requiring that files be generated in the directory indexes format was a mistake. As you might be able to tell, if Discharge is going to transform the files anyways when deploying to S3, it doesn’t really matter how the files are structured. Discharge could take `projects.html` and lop the `.html` off just as well as it could take `projects/index.html` and lop the `/index.html` off. There is no difference. The reason why this was a mistake is that this places a hard requirement on a static generator to be able to output files in a very specific way, which not all can. Fundamentally, how a URL maps to a static file isn’t really a concern of static site generators, it’s a concern of the static file host. S3 serves files one way, Netlify serves files a different way, etc. Not mandating that static site generators output files in a specific structure will allow Discharge to deploy static sites built by more static site generators. This change also has some additional, unexpected benefits. If you want to use clean URLs, you can’t _only_ upload the HTML file without the `.html` extension, because there are scenarios in which you might need to have an HTML file in your site that is consumed by a third-party service that you don’t control and it’s specifically requesting the file _with_ the `.html` extension. That means no matter which clean URLs option you use, Discharge will still have to upload a version of the file with the `.html` extension. That makes the difference between the clean URLs options so small that it obviates the need for that configuration option altogether. It’s easier to just upload two copies of every HTML file and everyone can use whatever URL style they prefer.
- Loading branch information
1 parent
49b1863
commit d0eeb58
Showing
7 changed files
with
56 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters