-
-
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
Make Astro.url conform to build.format during the build #4352
Conversation
🦋 Changeset detectedLatest commit: bfb9ba6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 packages
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 |
Thanks for this PR! I think it is worth a documentation update:
|
Good call-out, this change needs docs updates as well. |
Stupid question: is there a simple way for me to test this branch on my project? I tried using gitpkg.now.sh, as recommended on SO, but it failed with an error 500 |
There's not really a good way. Some times we've done PR releases but I'm not sure how involved that is. |
I was able to create a preview release, so you should be able to install with |
The associated docs PR for this (withastro/docs#1321) actually needs to target the |
Using your package
Both URLs reply, since I use |
Yep, ignore means ignore. It means you want to support both URL patterns. To do this you need to account for the fact that |
My main issue, is that it will behave differently when deployed. If I use the php server I just checked, and my actual hosting (netlify) redirects |
@oliverpool I don't know if we should reuse this config option to do redirects (maybe!) but the request for some solution is very reasonable. The place to talk about this would be in a discussion here: https://github.com/withastro/rfcs/discussions |
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.
lgtm
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.
I've been following the discussion of how trailing slash will work and this makes sense to me 👍
25830f8
to
9bcb6b3
Compare
Sorry if I'm not following, is this issue fixed? As I am seeing this exact behaviour. I'm using On running My config has: site: 'https://website.com', I'm running |
@GrantSmithDoddle which page do you visit on http://localhost:3000/page or You should probably set I mentioned this shortcoming in #4352 (comment), but AFAIK nothing has been done to prevent this inconsistent behavior... |
Changes
Astro.url.pathname
match what configuration is set to inbuild.format
.'directory'
it will be/page/
. If it is set to'file'
it will be/page.html
.Astro.url
resolve the way your configuration specifies.Testing
'directory'
and'file'
.Docs
astro.ts
types file.