FIX: Preserve anchors in permalink transitions (PR #10421)

When visiting a permalink with an anchor (e.g. /important-link#notes) the anchor part was being dropped during redirection.

The change doesn’t have a test. Functions like scrollToPost or scrollToElement don’t have any effect in the test environment.


Is it possible there’s already an anchor and this would be adding a second one?

It is! I’ve updated the code. It now replaces the anchor from the permalink when present.