Skip to content

Commit

Permalink
doc: add rel=prev/next for links to adjacent sections
Browse files Browse the repository at this point in the history
This help people using keyboard navigation or with disabilities to
easily browse through pagination. For example, in Vimium, a reader can
do `[[` or `]]` to browse through the pages.
  • Loading branch information
vincentbernat committed Jul 15, 2015
1 parent 5708b1a commit cfa8e48
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/rustbook/javascript.rs
Expand Up @@ -57,11 +57,13 @@ document.addEventListener("DOMContentLoaded", function(event) {
if (i > 0) {
var prevNode = toc[i-1].cloneNode(true);
prevNode.className = 'left';
prevNode.setAttribute('rel', 'prev');
nav.appendChild(prevNode);
}
if (i < toc.length - 1) {
var nextNode = toc[i+1].cloneNode(true);
nextNode.className = 'right';
nextNode.setAttribute('rel', 'next');
nav.appendChild(nextNode);
}
document.getElementById('page').appendChild(nav);
Expand Down

0 comments on commit cfa8e48

Please sign in to comment.