Internal links in xaringan presentations

Blog

I am currently revising the slides for the next iteration of my workshop on writing reproducible research papers with R Markdown. It will take place at Campus Luzern, over two full days in November 2020.

There are now over 200 slides in the presentation, and I thought it is now past time to introduce some internal links to facilitate navigation across the different parts of the presentation, which is written with xaringan.

How can we introduce internal links in xaringan? The linking syntax that you may be familiar with from R Markdown will not work here as we need to identify the target slides with the name argument.

For example, assume that our presentation has a contents slide, to which we would like to link back from certain other slides, such as the final slides of each section.

We first name the contents slide. Note that multi-word names require hyphenation.

---
name: contents-slide
## Contents
        
- Introduction
- Body
- Conclusion

---

We can than link back to the target slide as we would do in R Markdown documents.

---
# Thank you!

- Go [back to Contents](#contents-slide)

---

This strategy can work in both directions—not only for linking backward but also forward in a presentation.