```{contents} Table of Contents :depth: 2 :backlinks: none ``` # The problem A few years ago I started using [reveal.js](https://revealjs.com/) to prepare my scientific talks and I never looked back since then. Now I use it also for the programming class I teach to first-year students! The only thing I hate about reveal.js is its PDF-exporting features: perhaps it is my fault (although I have [rtfm'd](https://revealjs.com/pdf-export/)), but I never managed to generate a PDF that faithfully reproduced my presentation. And of course PDFs don't support movies (in a portable and reliable manner). When I decided to use Nikola to build my website I thought that I could maybe find a way of making my presentations available online as HTML pages. I didn't find any resources on the topic online, but I used what I learned about Nikola in those last weeks and I hacked up my own solution, which I'm going to describe here. # The strategy The basic idea is to have a custom template page `reveal.tmpl` that 1. loads the necessary reveal (and possibly custom) javascript and css files required to display the presentation 2. sets up the HTML bits that will contain the markdown/HTML code. The (markdown/HTML) content of each presentation is then copied in an HTML file containing the special `.. template: reveal.tmpl` metadata overriding the default template file for pages. # The template file If you are curious you can look at (and download) the custom template I have written here, which depends on the theme I'm using (a modified version of [bnw](https://themes.getnikola.com/v8/bnw/)) to output the first part of the HTML page. Here I will describe the most important parts of the template. I decided to use reveal.js version 4.1.2 and load the relevant file through a CDN, but the same procedure should work with any version and/or files stored elsewhere. We start with loading the CSS files in the `
` element: ```html ``` Here `slides.css` is the file containing my custom CSS styles. Within the `` element there is the reveal.js HTML boilerplate, where `${post.text()}` will be replaced by each presentation's content: ```html