Closed matthewp closed 1 year ago
Wondering if there is any updates on this, we really don't have control over client server setup and folders so a relative path would really be the best way we can let them drop the project to anywhere they want to.
@kelvin-zhao Are you ok with not having support for 404.astro
in SSG mode with this proposal? I still haven't thought of a way of avoiding that restriction.
The other thing missing is a good story around adding <a href>
, <img src>
, etc. I'm currently thinking about doing directive like <a relative:href="/other/page">
which would be transformed to <a href="../other/page">
.
@matthewp Tbh, I'm okay with any possible option... Currently I'm building the files, then manually go into different folders to update the paths on all links... It's so painful I'm halfway onto switching entire projects to other frameworks.
@kelvin-zhao Are you ok with not having support for
404.astro
in SSG mode with this proposal? I still haven't thought of a way of avoiding that restriction.The other thing missing is a good story around adding
<a href>
,<img src>
, etc. I'm currently thinking about doing directive like<a relative:href="/other/page">
which would be transformed to<a href="../other/page">
.
The 404 Problem only exists when serving the 404 Page without redirect, right? You could also implement 404 by sending an 302 Temporary redirect with the location of 404.html and then everything would work with a relative base.
Seems Parcel, https://parceljs.org/features/targets/#publicurl runs on default using relative paths, in case anyone is looking for alternative solutions. "In most cases, bundles are loaded using a relative path from the parent bundle to the child bundle. This allows the deployment to be moved to a new location without re-building (e.g. promoting a staging build to production)."
Are there any known hacks to get around this until official support lands? I need a relative path to css assets and I'm afraid I can't even manually edit the paths as the site is being built remotely through vercel ci. Perhaps a post-build npm script might work for me.
I'm not happy with the way this RFC makes Astro work 2 different ways. I'd prefer to find a path that works the same way in all cases. For that reason I'm going to close this PR as it stands and look into a different solution to the problem.
@matthewp can we put a link here to an RFC with a different solution?
While I understand your decision I have the feeling a single niche feature (404 page without redirect) is blocking simple fixes fix for a general problem and adding complexity to every decision in the build process. In hindsight I don't know if the feature was worth this trouble.
I have published an integration and hope it will be a solution.
I have published an integration and hope it will be a solution.
my build problem solved with this, Thanks mate
I have published an integration and hope it will be a solution.
This lib solves the problem.
Summary
Add support for relative links written out during the build, such as
<link rel="stylesheet" href="../assets/main.hash.css">
through a new build configuration.Links