How to specify which reveal.js presentation to run from a local web server?
Asked Answered
C

1

9

According to the reveal.js setup instructions, for some of the features to be available (like external Markdown and speaker notes), presentations need to run from a local web server.

However, if I follow the instructions there is no way to specify what presentation to start and all I get is a presentation containing two slides saying "Slide 1" and "Slide 2". When looking in the section above, it seems like it is the presentation "index.html" in the reveal.js repository that is presented, i.e. not the presentation I want to present.

How do I run my presentation from a local web server without copying or moving the contents of the reveal.js folder into the folder where my presentation is located and without copying, moving or renaming the presentation?

Camaraderie answered 7/7, 2017 at 22:13 Comment(0)
O
11

Use symbolic links.

Let's assume you have a directory under your home where you keep all your presentations. From the directory where you installed reveal.js run:

ln -s ~/presentations presentations

Then in the browser visit http://localhost:8000/presentations to get a list of all your presentation files (except of course if one of them is named index.html). Click any one of them to show it.

Note: If your presentations are located outside the server's root directory (the directory where you installed reveal.js), reveal.js resource links have to be absolute and not relative. This way, they'll get picked up as relative to the root directory (where reveal.js resides) instead of the current directory (where the presentations reside).

E.g. in the example presentation file, you would need to turn these lines:

<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/black.css">
<link rel="stylesheet" href="lib/css/zenburn.css">
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }

into:

<link rel="stylesheet" href="/css/reveal.css">
<link rel="stylesheet" href="/css/theme/black.css">
<link rel="stylesheet" href="/lib/css/zenburn.css">
<script src="/lib/js/head.min.js"></script>
<script src="/js/reveal.js"></script>
{ src: '/plugin/markdown/marked.js' },
{ src: '/plugin/markdown/markdown.js' },
{ src: '/plugin/notes/notes.js', async: true },
{ src: '/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
Opalescent answered 18/7, 2017 at 16:55 Comment(1)
I'm running Windows so ln -s won't work here. It might work with Windows symbolic links though; I will have to try it and see.Camaraderie

© 2022 - 2024 — McMap. All rights reserved.