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.

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

The linking syntax in R Markdown will not work here in xaringan presentations 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 backwards, but also forwards in a presentation.