From 13d0faf629fc9fbd99dbea3f839963c8d0b4233d Mon Sep 17 00:00:00 2001 From: dzello Date: Mon, 30 Apr 2018 13:19:22 -0700 Subject: [PATCH] Add hook to put content at end of head and body All Reveal params to be configured at default, site and page levels --- README.md | 10 +++++----- data/reveal_hugo.toml | 1 + exampleSite/content/example/_index.md | 1 + layouts/_default/baseof.reveal.html | 8 +++++--- layouts/partials/reveal-hugo/body.html | 2 +- layouts/partials/reveal-hugo/head.html | 1 + static/reveal-hugo/index.js | 13 +++++++++---- 7 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 layouts/partials/reveal-hugo/head.html diff --git a/README.md b/README.md index 5cc6102..320f477 100644 --- a/README.md +++ b/README.md @@ -108,15 +108,15 @@ This is my second slide. ## Usage -The Usage guide is contained in the example presentation that lives in this repository at `exampleSite`. You can access a live version at [https://dzello.com/reveal-hugo/](https://dzello.com/reveal-hugo/). +The Usage guide is contained in the example presentation that lives in this repository in the [exampleSite](./exampleSite) directory. You can access a live version at [https://dzello.com/reveal-hugo/](https://dzello.com/reveal-hugo/). ## Configuration -Customize the Reveal.js presentation by setting these values in `config.toml` or the front matter of any presentation's `index.md`. +Customize the Reveal.js presentation by setting these values in `config.toml` or the front matter of any presentation's `index.md` file. - `params.reveal_hugo.theme`: The Reveal.js theme used, defaults to "black" -Include any other attributes in `params.reveal_hugo` that you'd like to be fed as arguments to `Reveal.initialize`. See the [extensive list of options](https://github.com/hakimel/reveal.js/#configuration) here. Defaults used by this theme are located in `data/reveal_hugo.toml`. +Include any other attributes in `params.reveal_hugo` that you'd like to be fed as arguments to `Reveal.initialize`. See the [extensive list of Reveal.js configuration options](https://github.com/hakimel/reveal.js/#configuration) here. The defaults used by this theme are located in `data/reveal_hugo.toml`. If you're new to TOML, this is how it should look in your `config.toml`: @@ -132,9 +132,9 @@ Or in the front matter of an `_index.md` file: theme = "moon" ``` -## Injecting HTML +## Adding HTML to the page -If you need to add something to the HTML page, just override the empty partial that lives at `layouts/partials/reveal-hugo/body.html`. This partial is injected into the page just before the closing of the body tag. Common uses would be to add custom CSS or JS to the page. +If you need to add something to the HTML page, just override one or both of the empty partials that live at `layouts/partials/reveal-hugo/body.html` and `layouts/partials/reveal-hugo/head.html`. These partial are injected into the page just before the closing of the body and head tags respectively. Common uses would be to add custom CSS or JavaScript to your presentation. ### Add a Reveal.js presentation to an existing Hugo site diff --git a/data/reveal_hugo.toml b/data/reveal_hugo.toml index 184892e..eac6036 100644 --- a/data/reveal_hugo.toml +++ b/data/reveal_hugo.toml @@ -1,4 +1,5 @@ [defaults] +theme = 'black' controls = true progress = true history = true diff --git a/exampleSite/content/example/_index.md b/exampleSite/content/example/_index.md index 91a81a7..c5eacc8 100644 --- a/exampleSite/content/example/_index.md +++ b/exampleSite/content/example/_index.md @@ -3,6 +3,7 @@ title = "Example of a section presentation" outputs = ["Reveal"] [reveal_hugo] theme = "moon" +slideNumber = true +++ # Section Presentation diff --git a/layouts/_default/baseof.reveal.html b/layouts/_default/baseof.reveal.html index 5673bfe..419a9f5 100644 --- a/layouts/_default/baseof.reveal.html +++ b/layouts/_default/baseof.reveal.html @@ -9,7 +9,7 @@ - {{ $theme := or .Page.Params.reveal_hugo.theme .Site.Params.reveal_hugo.theme "black" }} + {{ $theme := or .Page.Params.reveal_hugo.theme .Site.Params.reveal_hugo.theme .Site.Data.reveal_hugo.theme "black" }} @@ -24,13 +24,15 @@ + {{ partial "reveal-hugo/head" . }} {{ block "main" . }}{{ end }} - + +