Open jmsfwk opened 4 hours ago
Interesting! Is there a reason you prefer it to do with directory/index.html
instead of server-config? In nginx it's adding a single $uri.html
:
location / {
try_files $uri.html $uri $uri/ /index.php?$query_string;
}
OTOH, I reckon there are cases where people don't have access to their server config. We might actually use the directory/index.html
approach everywhere instead? I wonder if there are any downsides… can you think of any?
I made a branch to try it out: https://github.com/tempestphp/tempest-framework/pull/479
Would you mind giving it a try as well? composer require tempest/framework:dev-static-generator-with-index-files
@brendt it's because I plan to host as a GitHub Pages site.
I'd suggest not changing how the generator works for now, but maybe allow for more control over the file that is generated eventually. That way different file types could be produced, e.g. RSS feeds.
Yeah that makes sense. However, if there are no real downsides to this approach, I see no reason why it shouldn't be the default one… It's less setup work for everyone, so everyone benefits.
Description
An event would be emitted for each static page that is generated. The event would include at least the path to the page.
Benefits
I’d like to use “pretty URLs” with my static content, e.g.
/contact-us
instead of/contact-us.html
. This can be achieved by placing a/contact-us/index.html
page.Instead of adding this as an option to the framework if there was an event I could create the “pretty” directories and move the generated file as they are generated.