docs(docs): preserve path to current doc page when switching versions

Preserve URL path when switching between doc versions.

Closes #4661
Closes #5773