Skip to content

Commit b543849

Browse files
authored
Merge pull request #12950 from quarto-dev/enhance/12949
ensure redirect preserves location hash and search
2 parents 094db5c + 5af7641 commit b543849

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

news/changelog-1.8.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ All changes included in 1.8:
5252
- ([#12551](https://github.com/quarto-dev/quarto-cli/pull/12551)): Improve warning issued when `aliases` would overwrite an existing document.
5353
- ([#12616](https://github.com/quarto-dev/quarto-cli/issues/12616)): find SVG images in image discovery for listings.
5454
- ([#12693](https://github.com/quarto-dev/quarto-cli/issues/12693)): Prevent resource exhaustion on large websites by serializing `NotebookContext` information to file instead of the environment.
55+
- ([#12949](https://github.com/quarto-dev/quarto-cli/issues/12949)): Ensure redirects preserve `hash` and `search` when possible.
5556

5657
## Crossrefs
5758

src/resources/projects/website/templates/redirect-map.ejs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
var hash = window.location.hash.startsWith('#') ? window.location.hash.slice(1) : window.location.hash;
88
var redirect = redirects[hash] || redirects[""] || "/";
99
window.document.title = 'Redirect to ' + redirect;
10+
if (!redirects[hash]) {
11+
redirect = redirect + window.location.hash;
12+
}
13+
redirect = redirect + window.location.search;
1014
window.location.replace(redirect);
1115
</script>
1216
</head>

0 commit comments

Comments
 (0)