doc: add rel=prev/next for links to adjacent sections

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.
This commit is contained in:
Vincent Bernat 2015-07-15 23:32:58 +02:00
parent 5708b1a18a
commit cfa8e48b21

View File

@ -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);