Commit f897702
authored
chore(vercel): use absolute hrefs in preview dir indexes (#31106)
Issue number: internal
---------
<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->
<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->
## What is the current behavior?
`generate_dir_index` in `core/scripts/vercel-build.sh` writes child
links like `<a href="basic/">` and an up-link `<a href="../">`. Vercel
doesn't 308-redirect to add a trailing slash, so visiting a preview
directory URL like `/src/components/progress-bar/test` (no slash)
returns the index page but the browser resolves `basic/` against the
parent directory. That path doesn't exist, and Vercel's fallback serves
the root landing page, so navigation looks like it "circles back" to the
preview home instead of opening the test scenario.
## What is the new behavior?
The dir-index generator now emits absolute hrefs based on the
directory's `url_path`, including the `../` up-link. Trailing-slash
quirks no longer affect navigation between component test scenarios on
Vercel previews.
## Does this introduce a breaking change?
- [ ] Yes
- [x] No
<!--
If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->
## Other information
Test page:
-
https://ionic-framework-git-fix-vercel-preview-links-ionic1.vercel.app/src/components/progress-bar/test
Versus the broken version on main:
-
https://ionic-framework-git-main-ionic1.vercel.app/src/components/progress-bar/test1 parent d26017f commit f897702
1 file changed
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
| |||
70 | 76 | | |
71 | 77 | | |
72 | 78 | | |
73 | | - | |
| 79 | + | |
74 | 80 | | |
75 | 81 | | |
76 | 82 | | |
| |||
92 | 98 | | |
93 | 99 | | |
94 | 100 | | |
95 | | - | |
| 101 | + | |
96 | 102 | | |
97 | 103 | | |
98 | 104 | | |
| |||
0 commit comments