Repository: rust-lang/mdBook (language: rust)

Issue:
Add prefetch to next link
https://github.com/rust-lang/mdBook/blob/41a6f0d43e1a2d9543877eacb4cd2a017f9fe8da/src/theme/index.hbs#L213

I was navigating through some books with short pages like https://google.github.io/comprehensive-rust/control-flow/break-continue.html, was trying to go through pages and pages through next button `]]` using vimium extension, I find it a bit slow, maybe prefetching would help and loading the user waiting time for the next page? Like `<a rel="next prefetch" ...>`.

I think maybe the previous don't need it since the chance of reading the previous page over the next pages is lesser, and books are usually not expected to read in the reversed order.


Discussion / hints:
> I was navigating through some books with short pages like https://google.github.io/comprehensive-rust/control-flow/break-continue.html, was trying to go through pages and pages through next button `]]` using vimium extension, I find it a bit slow, maybe prefetching would help and loading the user waiting time for the next page? Like `<a rel="next prefetch" ...>`.

Hi @pickfire! We could fix this in the template used in Comprehensive Rust! I think it's a good idea, would you mind opening a PR for us?

Fix patch:
diff --git a/src/theme/index.hbs b/src/theme/index.hbs
index 80315c48f2..0c01fa3b2c 100644
--- a/src/theme/index.hbs
+++ b/src/theme/index.hbs
@@ -217,7 +217,7 @@
                         {{/previous}}
 
                         {{#next}}
-                            <a rel="next" href="{{ path_to_root }}{{link}}" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
+                            <a rel="next prefetch" href="{{ path_to_root }}{{link}}" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
                                 <i class="fa fa-angle-right"></i>
                             </a>
                         {{/next}}
@@ -235,7 +235,7 @@
                 {{/previous}}
 
                 {{#next}}
-                    <a rel="next" href="{{ path_to_root }}{{link}}" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
+                    <a rel="next prefetch" href="{{ path_to_root }}{{link}}" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
                         <i class="fa fa-angle-right"></i>
                     </a>
                 {{/next}}


Test patch: