Skip to content

Commit

Permalink
Fix double slashes in search URLs
Browse files Browse the repository at this point in the history
Changelog: fixed
  • Loading branch information
yorickpeterse committed Jun 30, 2024
1 parent 0cf8c21 commit 5f34658
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/idoc/html.inko
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ fn link(href: String, rel: String) -> Element {
fn head(page: String, title: String) -> Element {
let head = Element.new('head')

head.attr('data-to-root', relative_url(page, '/'))
# We remove the trailing / here so that in the JS code we can just do the
# equivalent of `data-to-root + link`, without ending up with duplicate
# slashes (e.g. foo.com//module/...) in the URLs.
head.attr('data-to-root', relative_url(page, '/').strip_suffix('/'))

# The search data can get pretty big so we want to cache it. Since the file is
# generated dynamically, we can't use inko-wobsite's asset hashing feature,
Expand Down

0 comments on commit 5f34658

Please sign in to comment.