Finalized glue
Added application glue presentation
Add keybase logo and slide about adding
eSolia is publishing presentation slides at show.esolia.pro, the repo for which is this site. The site is assembled with the very fast static site generator Hugo, and works to turn Markdown files into HTML presentations because of the Reveal.js javascript library.
Many thanks and kudos go to:
Using reveal-hugo, presentations with multiple slides can be created with just one markdown file, by putting a ---
between slides, like so:
+++
title = "How to say hello"
+++
# English
Hello.
---
# 日本語
こんにちは。
The "reveal hugo" theme is meant to be plugged in to a Hugo site in the usual way for installing themes. In this case, I incorporated it by copying its files directly into the usual places Hugo expects - layouts, data, static.
layouts/_default/baseof.reveal.html
.content/12-factor-app-and-engineer
to another folder and edit its files.
_index.md
- the main file that gets loaded and makes settings.whatever1.md
and whatever2.md
- get loaded after what's in _index.md
by their "weight".https://show.esolia.pro/12-factor-app-and-engineer
.layouts/partials/reveal-hugo
into a folder with the same name as that of the presentation under content. If the presentation is in esolia_intro_2018
, then copy into layouts/partials/esolia_intro_2018/reveal-hugo
.data
and accessed as a slide via a shortcode. Given data/slides.toml
, you would access a key called "arigato" in your slide, via the "slide" shortcode, as {{% slide content="slides.arigato" %}}
. That creates a slide where you specify, by copying the info in the data file.The reveal-hugo theme comes with a variety of Hugo shortcodes that you use in your presentation's markdown files to take advantage of Reveal.js features. The following info is from the theme's readme:
Wrap any content in the fragment shortcode and it will appear incrementally. Great for bulleted lists where you want one bullet point at a a time to appear.
- {{% fragment %}}One{{% /fragment %}}
- {{% fragment %}}Two{{% /fragment %}}
- {{% fragment %}}Three{{% /fragment %}}
Like fragment but more terse - content is placed inline in a self-closing shortcode.
- {{< frag c="One" >}}
- {{< frag c="Two" >}}
- {{< frag c="Three" >}}
The slide shortcode lets you set custom HTML and Reveal.js attributes for each slide - things like id, class, transition, background just to name a few. The names are the same as Reveal.js but without the 'data-' prefix.
Add the shortcode above the slide content, below the ---
separator. Do not place content inside of the shortcode.
---
{{< slide id="hello" background="#FFF" transition="zoom" transition-speed="fast" >}}
# Hello, world!
---
Here's a list of documented slide attributes from the Reveal.js docs:
autoslide
state
background
background-color
background-image
background-size
background-position
background-repeat
background-video
background-video-loop
background-video-muted
background-interactive
background-iframe
background-transition
transition
(can have different in and out transitions)transition-speed
notes
(can also use the note shortcode)timing
You can also pass through your own, a data-
prefix will be added automatically to each one (except for id
and class
).
To create groups of slides that can be navigated vertically, surround your markdown with the section shortcode.
{{% section %}}
# Vertical slide 1
---
# Vertical slide 2
{{% /section %}}
Add speaker notes for each slide with the note shortcode.
{{% note %}}
Don't forget to thank the audience.
{{% /note %}}
💡 Tip: you can also add notes by adding a note
attribute to the slide shortcode.
Markdown surrounded by the markdown shortcode will not be rendered by Hugo but by Reveal.js itself. This is useful if you want to use some native Reveal.js markdown syntax that isn't supported by reveal-hugo.
{{% markdown %}}
# I'm rendered...
...by Reveal.js
{{% /markdown %}}
If you need to create fancier HTML for a slide than you can do with markdown, just add data-noprocess
to the <section> element.
<section data-noprocess>
<h1>Hello, world!</h1>
</section>
Sometimes you need to reuse a slide in the same presentation or across different presentations. reveal-hugo makes use of Hugo data templates to make both cases easy.
To create reusable slides, create a TOML (or JSON or YAML) file in your site's data directory. Give it a name that reflects its content or just slides.toml
. In that file, add a key for each reusable slide. The name should reflect the slide's content and the value should be the slide's markdown.
thankyou = '''
# Thank you!
Any questions?
'''
💡 Tip: TOML's multiline string syntax comes in handy here, note the '''.
Each key can contain one or more slides separated by ---
and newlines. That way you can create reusable sections.
thankyou = '''
# Thank you!
---
Any questions?
'''
To render a slide from a data template, use the slide shortcode with a content attribute:
{{% slide content="slides.thankyou" /%}}
The part before the "." is the name of the file in the data directory. The part after the dot is the key to look up in that file.
You can use all the additional slide shortcode attributes. They will be applied to every slide in the data template.
Customize the Reveal.js presentation by setting these values in config.toml
or the front matter of any presentation's _index.md
file.
reveal_hugo.theme
: The Reveal.js theme used; defaults to "black"reveal_hugo.custom_theme
: The path to a locally hosted Reveal.js theme in the static folderreveal_hugo.highlight_theme
: The highlight.js theme used; defaults to "default"reveal_hugo.reveal_cdn
: The location to load Reveal.js files from; defaults to the reveal-js
folder in the static directory to support offline development. To load from a CDN instead, set this value to https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.7.0
or whatever CDN you prefer.reveal_hugo.highlight_cdn
: The location to load highlight.js files from; defaults to https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0
. For local development, change this to point to a file in the static directory.This is how parameters will look in your config.toml
:
[params.reveal_hugo]
theme = "moon"
Or in the front matter of an _index.md
file:
[reveal_hugo]
theme = "moon"
Include any other attributes in those sections that you'd like to be fed as arguments to Reveal.initialize
in snakecase, so slide_number
instead of slideNumber
. Params are converted from snakecase to camelcase before passing to Reveal.js. This is necessary to maintain the proper case of the parameters.
Here's an example of configuring Reveal.js parameters alongside a theme and highlight.js theme:
[reveal_hugo]
theme = "moon"
highlight_theme = "solarized-dark"
slide_number = true
transition = "zoom"
See the extensive list of Reveal.js configuration options here.
If you have a custom reveal theme to use (in .css form), place it somewhere in your static folder. For example, if you have:
- static
- assets
- custom-theme.css
Then you will need to have this line in config.toml
[params.reveal_hugo]
reveal_hugo.custom_theme = "assets/custom-theme.css"
If you need to add something to the HTML layout, you can create partials that live at specific locations, depending on which presentation you want to customize and where you want the HTML inserted into the page.
Presentation | Before </head> | Before </body> | Before closing </div> of div.reveal |
---|---|---|---|
All | reveal-hugo/head.html | reveal-hugo/body.html | reveal-hugo/end.html |
Root | home/reveal-hugo/head.html | home/reveal-hugo/body.html | home/reveal-hugo/end.html |
Section | {section}/reveal-hugo/head.html | {section}/reveal-hugo/body.html | {section}/reveal-hugo/end.html |
This is the recommended way to add custom CSS and JavaScript to each presentation.
💡 Tip: In Hugo, partials live in the
layouts
folder:For example, if you have HTML that is to be placed before every presentation, this would be the structure:
- layouts - partials - reveal-hugo - head.html - body.html - end.html
These are some useful Reveal.js features and shortcuts.
Here are a few useful Reveal.js-related tools:
Find many more on the Reveal.js wiki: Plugins, tools and hardware.