-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Write index routes as index.html with build.format: 'file' #9209
Conversation
🦋 Changeset detectedLatest commit: a619adc The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
I think the previous behaviour is expected to me:
The "forcing" style intentionally doesn't respect how you declare your files. With this PR, it also slightly conflicts with our recommendation here:
Practically speaking though, I prefer that Astro doesn't force a certain build format style and always respect how the files were declared. This PR seems to make |
let dir; | ||
// If the pathname is '' then this is the root index.html | ||
// If this is an index route, the folder should be the pathname, not the parent | ||
if(pathname === '' || routeData.index) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Maybe we could omit the check for an empty pathname since, in this scenario, it's guaranteed to represent an index route, isn't it?
@bluwy I, good point. I'll move this back into draft for discussion then. |
@bluwy what would you think about adding this as |
That makes sense to me 👍 aside from this part:
I think it might still be worth keeping it. Currently it seems like there's a symmetry with
So if we plan on keeping |
We're probably going to do this in a minor release as the discussion above about making this a new format means it will not be a breaking change. So deprioritizing, but keeping on my personal board. |
Closing the PR, but will reopen later with new implementation. |
Changes
index.astro
orindex.md
) when writing files withbuild.format: 'file'
. This is because the logic only looked at the pathname and didn't know it was an index route.Testing
Docs