Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions apps/svelte.dev/src/routes/docs/[...path]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,18 @@
return;
}

const id = hash.toLowerCase().replaceAll(':', '-');
// kit/svelte4 replaced `:` character
// e.g. we want to redirect progressive-enhancement-use-enhance to Progressive-enhancement-use:enhance
// kit docs also had types in URL that we want to replace. e.g.
// https://kit.svelte.dev/docs/types#public-types-loadevent
// https://kit.svelte.dev/docs/types#private-types-cspdirectives
const id = hash
.toLowerCase()
.replaceAll(':', '-')
.replaceAll('public-types-', '')
.replaceAll('private-types-', '');

for (const heading of content.querySelectorAll('[id]')) {
// e.g. we want to redirect progressive-enhancement-use-enhance to Progressive-enhancement-use:enhance
if (heading.id.toLowerCase().replaceAll(':', '-') === id) {
goto(`#${heading.id}`, {
replaceState: true
Expand Down
Loading