aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/redirects.js
diff options
context:
space:
mode:
authorValentin Gagarin <valentin.gagarin@tweag.io>2022-11-09 00:49:34 +0100
committerValentin Gagarin <valentin.gagarin@tweag.io>2022-11-09 00:49:34 +0100
commitdaedaa197dbbb688323f2b22b898304c24f9c051 (patch)
tree0d4b8520a920fbaa87238b6b4e53e8e8152db23f /doc/manual/redirects.js
parent8dd5ba2f472172eb1a8a8df31715726cc53d6344 (diff)
fix typos in comments
Diffstat (limited to 'doc/manual/redirects.js')
-rw-r--r--doc/manual/redirects.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/doc/manual/redirects.js b/doc/manual/redirects.js
index d9b27d866..2e77edd0f 100644
--- a/doc/manual/redirects.js
+++ b/doc/manual/redirects.js
@@ -2,12 +2,12 @@
// this must be done on the client side, as web servers do not see the anchor part of the URL.
// redirections are declared as follows:
-// each entry has as key the matched URL path relative to the mdBook document root.
+// each entry has as its key a path matching the requested URL path, relative to the mdBook document root.
//
// IMPORTANT: it must specify the full path with file name and suffix
//
-// each entry is a set of key-value pairs, where
-// - keys are anchors on to the matched path.
+// each entry is itself a set of key-value pairs, where
+// - keys are anchors on the matched path.
// - values are redirection targets relative to the current path.
const redirects = {
@@ -352,16 +352,16 @@ const redirects = {
//
// matching URLs is more involved than it should be:
//
-// 1. `document.location.pathname` can have an have an arbitrary prefix.
+// 1. `document.location.pathname` can have an arbitrary prefix.
//
-// 2. `path_to_root` is set by mdBook and consists only of `../`s and
+// 2. `path_to_root` is set by mdBook. it consists only of `../`s and
// determines the depth of `<path>` relative to the prefix:
//
// `document.location.pathname`
// |------------------------------|
// /<prefix>/<path>/[<file>[.html]][#<anchor>]
// |----|
-// `path_to_root` has same number of segments
+// `path_to_root` has same number of path segments
//
// source: https://phaiax.github.io/mdBook/format/theme/index-hbs.html#data
//
@@ -410,7 +410,9 @@ const path = segments.join('/');
// anchor starts with the hash character (`#`),
// but our redirect declarations don't, so we strip it.
-// example: document.location.hash -> '#foo'
+// example:
+// document.location.hash -> '#foo'
+// document.location.hash.substring(1) -> 'foo'
const anchor = document.location.hash.substring(1);
const redirect = redirects[path];