diff --git a/README.md b/README.md index b5540fa..6470efd 100644 --- a/README.md +++ b/README.md @@ -31,16 +31,14 @@ The only requirement is to demarcate slides with `---` surrounded by newlines. Visit [https://dzello.com/reveal-hugo/](https://dzello.com/reveal-hugo/) to see an presentation created with this theme that shows more ways to use it. You can also check out this repository [running on Netlify](https://reveal-hugo.netlify.com/). -# Usage +# Step-by-step guide to create a presentation -[Install Hugo](https://gohugo.io/) and create a new Hugo site. +[Install Hugo](https://gohugo.io/) and create a new Hugo site: ```shell $ hugo new site my-presentation ``` -*Note: if you wish to add a Reveal.js presentation to an existing Hugo site without changing its theme, you can see [an example here](https://github.com/dzello/dzello-dot-com).* - Change into the directory of the new site: ```shell @@ -53,11 +51,21 @@ Clone this repository into the themes directory: $ git clone git@github.com:dzello/reveal-hugo.git themes/reveal-hugo ``` +Open `config.toml` and add a new output format called `Reveal`: + +```toml +[outputFormats.Reveal] +baseName = "index" +mediaType = "text/html" +isHTML = true +``` + Create a file in `content/_index.md` with this contents: -``` +```markdown +++ title = "My presentation" +outputs = ["Reveal"] +++ # Hello world! @@ -75,7 +83,7 @@ Navigate to [http://localhost:1313/](http://localhost:1313/) and you should see ![New site with reveal-hugo](/images/reveal-hugo-hello-world.png) -To add more slides, just add content to `_index.md`. Remember to separate each slide separated by `---` surrounded by newlines. +To add more slides, you can add content to `_index.md` or create new markdown files in `content/home`. Remember to separate each slide separated by `---` surrounded by newlines. ```markdown @@ -102,17 +110,48 @@ weight = 20 ### Section presentations -To create more presentations in the same repository, place the content into sections. Section presentations will include content from each file in that section including an `_index.md` file if it exists. Again, use the `weight` param to order the sections (`_index.md` will always be first). +To create a presentation for the content of any section of your Hugo site, just add `Reveal` to its list of `outputFormats` in the front matter of `section/_index.md`: -Section presentations can use a different Reveal.js theme by specifying the `reveal_theme` parameter in the front matter of the section's `_index.md` file. +```toml +outputs = ["Reveal"] +``` + +Section presentations will include content from each file in that section. Again, use the `weight` param to order the sections, knowing that any content in `_index.md` will come first. + +Presentations can use a different Reveal.js theme by specifying the `reveal_theme` parameter in the front matter of the section's `_index.md` file. ```toml reveal_theme = "moon" ``` +### Add a Reveal.js presentation to an existing Hugo site + +If your Hugo site already has a theme but you'd like to create a presentation from some of its content, that's very easy. First, manually copy a few files out of this theme into a few of your site's directories: + +```shell +$ cd my-hugo-site +$ git clone git@github.com:dzello/reveal-hugo.git themes/reveal-hugo +$ cp -r themes/reveal-hugo/static/reveal static/reveal +$ cp themes/reveal-hugo/layouts/_default/*.reveal.html layouts/_default +$ cp themes/reveal-hugo/layouts/shortcodes/* layouts/shortcodes +``` + +Next, add the Reveal output format to your site's `config.toml` file + +```toml +[outputFormats.Reveal] +baseName = "index" +mediaType = "text/html" +isHTML = true +``` + +Now you can add `outputs = ["Reveal"]` to the front matter of any section's `_index.md` file and that sections content will be combined into a presentation and saved to `index.html`. If you already have a normal `index.html` page for that section, just change the `baseName` above to `reveal` and the presentation will be placed in a `reveal.html` file instead. + +Note: If you specify `outputs = ["Reveal"]` for a single content file, you can make sure nothing is generated for that file. This is handy if you other default layouts that would have created a regular HTML file from it. Only the list file is required for the presentation. + ### Fragments -Fragments are a Reveal.js concept that lets you introduce content into each slide incrementally. Borrowing the concept from [hugo-theme-revealjs](https://github.com/RealOrangeOne/hugo-theme-revealjs), you can use a `fragment` shortcode to accomplish this in reveal-hugo in the same way. +Fragments are a Reveal.js concept that lets you introduce content into each slide incrementally. Borrowing the idea from [hugo-theme-revealjs](https://github.com/RealOrangeOne/hugo-theme-revealjs) (thanks!), you can use a `fragment` shortcode to accomplish this in reveal-hugo in the same way. ```markdown # Let's count to three... @@ -121,7 +160,8 @@ Fragments are a Reveal.js concept that lets you introduce content into each slid {{% fragment %}} Three {{% /fragment %}} ``` - # Configuration +These settings go in `config.toml`: + - `params.reveal_theme`: The Reveal.js theme used, defaults to "black" diff --git a/exampleSite/config.toml b/exampleSite/config.toml index f816f76..e6ea537 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -1,6 +1,7 @@ baseURL = "https://reveal-hugo.netlify.com/" languageCode = "en-us" title = "A Hugo theme for creating Reveal.js presentations" +disableKinds = ["sitemap", "RSS"] [author] name = "Josh Dzielak" @@ -8,3 +9,8 @@ name = "Josh Dzielak" [params] description = "A description of this presentation" reveal_theme = "solarized" + +[outputFormats.Reveal] +baseName = "index" +mediaType = "text/html" +isHTML = true diff --git a/exampleSite/content/_index.md b/exampleSite/content/_index.md index f822e6c..934afaf 100644 --- a/exampleSite/content/_index.md +++ b/exampleSite/content/_index.md @@ -1,5 +1,6 @@ +++ title = "reveal-hugo example presentation" +outputs = ["Reveal"] +++ # reveal-hugo diff --git a/exampleSite/content/example/_index.md b/exampleSite/content/example/_index.md index 15bfb2c..74a0c2d 100644 --- a/exampleSite/content/example/_index.md +++ b/exampleSite/content/example/_index.md @@ -1,5 +1,6 @@ +++ title = "Example of a section presentation" +outputs = ["Reveal"] reveal_theme = "moon" +++ diff --git a/exampleSite/content/home/body.md b/exampleSite/content/home/body.md index 6162980..3ddcf23 100644 --- a/exampleSite/content/home/body.md +++ b/exampleSite/content/home/body.md @@ -22,7 +22,11 @@ weight = 20 # reveal-hugo -Create multiple presentations, one for each section in `content`. +Create a presentation for any section by adding this to its `_index.md`: + +```toml +outputs = ["Reveal"] +``` --- diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.reveal.html similarity index 50% rename from layouts/_default/baseof.html rename to layouts/_default/baseof.reveal.html index 4413ae6..4d221a6 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.reveal.html @@ -8,28 +8,27 @@ - + {{ $theme := or .Page.Params.reveal_theme .Site.Params.reveal_theme "black" }} - + - + - {{ block "main" . }} - {{ end }} - - + {{ block "main" . }}{{ end }} + + diff --git a/layouts/index.html b/layouts/_default/index.reveal.html similarity index 100% rename from layouts/index.html rename to layouts/_default/index.reveal.html diff --git a/layouts/_default/list.html b/layouts/_default/list.reveal.html similarity index 100% rename from layouts/_default/list.html rename to layouts/_default/list.reveal.html diff --git a/layouts/_default/single.reveal.html b/layouts/_default/single.reveal.html new file mode 100644 index 0000000..e69de29 diff --git a/layouts/home/list.html b/layouts/home/list.html deleted file mode 100644 index 008c26a..0000000 --- a/layouts/home/list.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/css/print/paper.css b/static/reveal/css/print/paper.css similarity index 100% rename from static/css/print/paper.css rename to static/reveal/css/print/paper.css diff --git a/static/css/print/pdf.css b/static/reveal/css/print/pdf.css similarity index 100% rename from static/css/print/pdf.css rename to static/reveal/css/print/pdf.css diff --git a/static/css/reveal.css b/static/reveal/css/reveal.css similarity index 100% rename from static/css/reveal.css rename to static/reveal/css/reveal.css diff --git a/static/css/reveal.scss b/static/reveal/css/reveal.scss similarity index 100% rename from static/css/reveal.scss rename to static/reveal/css/reveal.scss diff --git a/static/css/theme/README.md b/static/reveal/css/theme/README.md similarity index 100% rename from static/css/theme/README.md rename to static/reveal/css/theme/README.md diff --git a/static/css/theme/beige.css b/static/reveal/css/theme/beige.css similarity index 100% rename from static/css/theme/beige.css rename to static/reveal/css/theme/beige.css diff --git a/static/css/theme/black.css b/static/reveal/css/theme/black.css similarity index 100% rename from static/css/theme/black.css rename to static/reveal/css/theme/black.css diff --git a/static/css/theme/blood.css b/static/reveal/css/theme/blood.css similarity index 100% rename from static/css/theme/blood.css rename to static/reveal/css/theme/blood.css diff --git a/static/css/theme/league.css b/static/reveal/css/theme/league.css similarity index 100% rename from static/css/theme/league.css rename to static/reveal/css/theme/league.css diff --git a/static/css/theme/moon.css b/static/reveal/css/theme/moon.css similarity index 100% rename from static/css/theme/moon.css rename to static/reveal/css/theme/moon.css diff --git a/static/css/theme/night.css b/static/reveal/css/theme/night.css similarity index 100% rename from static/css/theme/night.css rename to static/reveal/css/theme/night.css diff --git a/static/css/theme/serif.css b/static/reveal/css/theme/serif.css similarity index 100% rename from static/css/theme/serif.css rename to static/reveal/css/theme/serif.css diff --git a/static/css/theme/simple.css b/static/reveal/css/theme/simple.css similarity index 100% rename from static/css/theme/simple.css rename to static/reveal/css/theme/simple.css diff --git a/static/css/theme/sky.css b/static/reveal/css/theme/sky.css similarity index 100% rename from static/css/theme/sky.css rename to static/reveal/css/theme/sky.css diff --git a/static/css/theme/solarized.css b/static/reveal/css/theme/solarized.css similarity index 100% rename from static/css/theme/solarized.css rename to static/reveal/css/theme/solarized.css diff --git a/static/css/theme/source/beige.scss b/static/reveal/css/theme/source/beige.scss similarity index 100% rename from static/css/theme/source/beige.scss rename to static/reveal/css/theme/source/beige.scss diff --git a/static/css/theme/source/black.scss b/static/reveal/css/theme/source/black.scss similarity index 100% rename from static/css/theme/source/black.scss rename to static/reveal/css/theme/source/black.scss diff --git a/static/css/theme/source/blood.scss b/static/reveal/css/theme/source/blood.scss similarity index 100% rename from static/css/theme/source/blood.scss rename to static/reveal/css/theme/source/blood.scss diff --git a/static/css/theme/source/league.scss b/static/reveal/css/theme/source/league.scss similarity index 100% rename from static/css/theme/source/league.scss rename to static/reveal/css/theme/source/league.scss diff --git a/static/css/theme/source/moon.scss b/static/reveal/css/theme/source/moon.scss similarity index 100% rename from static/css/theme/source/moon.scss rename to static/reveal/css/theme/source/moon.scss diff --git a/static/css/theme/source/night.scss b/static/reveal/css/theme/source/night.scss similarity index 100% rename from static/css/theme/source/night.scss rename to static/reveal/css/theme/source/night.scss diff --git a/static/css/theme/source/serif.scss b/static/reveal/css/theme/source/serif.scss similarity index 100% rename from static/css/theme/source/serif.scss rename to static/reveal/css/theme/source/serif.scss diff --git a/static/css/theme/source/simple.scss b/static/reveal/css/theme/source/simple.scss similarity index 100% rename from static/css/theme/source/simple.scss rename to static/reveal/css/theme/source/simple.scss diff --git a/static/css/theme/source/sky.scss b/static/reveal/css/theme/source/sky.scss similarity index 100% rename from static/css/theme/source/sky.scss rename to static/reveal/css/theme/source/sky.scss diff --git a/static/css/theme/source/solarized.scss b/static/reveal/css/theme/source/solarized.scss similarity index 100% rename from static/css/theme/source/solarized.scss rename to static/reveal/css/theme/source/solarized.scss diff --git a/static/css/theme/source/white.scss b/static/reveal/css/theme/source/white.scss similarity index 100% rename from static/css/theme/source/white.scss rename to static/reveal/css/theme/source/white.scss diff --git a/static/css/theme/template/mixins.scss b/static/reveal/css/theme/template/mixins.scss similarity index 100% rename from static/css/theme/template/mixins.scss rename to static/reveal/css/theme/template/mixins.scss diff --git a/static/css/theme/template/settings.scss b/static/reveal/css/theme/template/settings.scss similarity index 100% rename from static/css/theme/template/settings.scss rename to static/reveal/css/theme/template/settings.scss diff --git a/static/css/theme/template/theme.scss b/static/reveal/css/theme/template/theme.scss similarity index 100% rename from static/css/theme/template/theme.scss rename to static/reveal/css/theme/template/theme.scss diff --git a/static/css/theme/white.css b/static/reveal/css/theme/white.css similarity index 100% rename from static/css/theme/white.css rename to static/reveal/css/theme/white.css diff --git a/static/js/reveal.js b/static/reveal/js/reveal.js similarity index 100% rename from static/js/reveal.js rename to static/reveal/js/reveal.js diff --git a/static/lib/css/zenburn.css b/static/reveal/lib/css/zenburn.css similarity index 100% rename from static/lib/css/zenburn.css rename to static/reveal/lib/css/zenburn.css diff --git a/static/lib/font/league-gothic/LICENSE b/static/reveal/lib/font/league-gothic/LICENSE similarity index 100% rename from static/lib/font/league-gothic/LICENSE rename to static/reveal/lib/font/league-gothic/LICENSE diff --git a/static/lib/font/league-gothic/league-gothic.css b/static/reveal/lib/font/league-gothic/league-gothic.css similarity index 100% rename from static/lib/font/league-gothic/league-gothic.css rename to static/reveal/lib/font/league-gothic/league-gothic.css diff --git a/static/lib/font/league-gothic/league-gothic.eot b/static/reveal/lib/font/league-gothic/league-gothic.eot similarity index 100% rename from static/lib/font/league-gothic/league-gothic.eot rename to static/reveal/lib/font/league-gothic/league-gothic.eot diff --git a/static/lib/font/league-gothic/league-gothic.ttf b/static/reveal/lib/font/league-gothic/league-gothic.ttf similarity index 100% rename from static/lib/font/league-gothic/league-gothic.ttf rename to static/reveal/lib/font/league-gothic/league-gothic.ttf diff --git a/static/lib/font/league-gothic/league-gothic.woff b/static/reveal/lib/font/league-gothic/league-gothic.woff similarity index 100% rename from static/lib/font/league-gothic/league-gothic.woff rename to static/reveal/lib/font/league-gothic/league-gothic.woff diff --git a/static/lib/font/source-sans-pro/LICENSE b/static/reveal/lib/font/source-sans-pro/LICENSE similarity index 100% rename from static/lib/font/source-sans-pro/LICENSE rename to static/reveal/lib/font/source-sans-pro/LICENSE diff --git a/static/lib/font/source-sans-pro/source-sans-pro-italic.eot b/static/reveal/lib/font/source-sans-pro/source-sans-pro-italic.eot similarity index 100% rename from static/lib/font/source-sans-pro/source-sans-pro-italic.eot rename to static/reveal/lib/font/source-sans-pro/source-sans-pro-italic.eot diff --git a/static/lib/font/source-sans-pro/source-sans-pro-italic.ttf b/static/reveal/lib/font/source-sans-pro/source-sans-pro-italic.ttf similarity index 100% rename from static/lib/font/source-sans-pro/source-sans-pro-italic.ttf rename to static/reveal/lib/font/source-sans-pro/source-sans-pro-italic.ttf diff --git a/static/lib/font/source-sans-pro/source-sans-pro-italic.woff b/static/reveal/lib/font/source-sans-pro/source-sans-pro-italic.woff similarity index 100% rename from static/lib/font/source-sans-pro/source-sans-pro-italic.woff rename to static/reveal/lib/font/source-sans-pro/source-sans-pro-italic.woff diff --git a/static/lib/font/source-sans-pro/source-sans-pro-regular.eot b/static/reveal/lib/font/source-sans-pro/source-sans-pro-regular.eot similarity index 100% rename from static/lib/font/source-sans-pro/source-sans-pro-regular.eot rename to static/reveal/lib/font/source-sans-pro/source-sans-pro-regular.eot diff --git a/static/lib/font/source-sans-pro/source-sans-pro-regular.ttf b/static/reveal/lib/font/source-sans-pro/source-sans-pro-regular.ttf similarity index 100% rename from static/lib/font/source-sans-pro/source-sans-pro-regular.ttf rename to static/reveal/lib/font/source-sans-pro/source-sans-pro-regular.ttf diff --git a/static/lib/font/source-sans-pro/source-sans-pro-regular.woff b/static/reveal/lib/font/source-sans-pro/source-sans-pro-regular.woff similarity index 100% rename from static/lib/font/source-sans-pro/source-sans-pro-regular.woff rename to static/reveal/lib/font/source-sans-pro/source-sans-pro-regular.woff diff --git a/static/lib/font/source-sans-pro/source-sans-pro-semibold.eot b/static/reveal/lib/font/source-sans-pro/source-sans-pro-semibold.eot similarity index 100% rename from static/lib/font/source-sans-pro/source-sans-pro-semibold.eot rename to static/reveal/lib/font/source-sans-pro/source-sans-pro-semibold.eot diff --git a/static/lib/font/source-sans-pro/source-sans-pro-semibold.ttf b/static/reveal/lib/font/source-sans-pro/source-sans-pro-semibold.ttf similarity index 100% rename from static/lib/font/source-sans-pro/source-sans-pro-semibold.ttf rename to static/reveal/lib/font/source-sans-pro/source-sans-pro-semibold.ttf diff --git a/static/lib/font/source-sans-pro/source-sans-pro-semibold.woff b/static/reveal/lib/font/source-sans-pro/source-sans-pro-semibold.woff similarity index 100% rename from static/lib/font/source-sans-pro/source-sans-pro-semibold.woff rename to static/reveal/lib/font/source-sans-pro/source-sans-pro-semibold.woff diff --git a/static/lib/font/source-sans-pro/source-sans-pro-semibolditalic.eot b/static/reveal/lib/font/source-sans-pro/source-sans-pro-semibolditalic.eot similarity index 100% rename from static/lib/font/source-sans-pro/source-sans-pro-semibolditalic.eot rename to static/reveal/lib/font/source-sans-pro/source-sans-pro-semibolditalic.eot diff --git a/static/lib/font/source-sans-pro/source-sans-pro-semibolditalic.ttf b/static/reveal/lib/font/source-sans-pro/source-sans-pro-semibolditalic.ttf similarity index 100% rename from static/lib/font/source-sans-pro/source-sans-pro-semibolditalic.ttf rename to static/reveal/lib/font/source-sans-pro/source-sans-pro-semibolditalic.ttf diff --git a/static/lib/font/source-sans-pro/source-sans-pro-semibolditalic.woff b/static/reveal/lib/font/source-sans-pro/source-sans-pro-semibolditalic.woff similarity index 100% rename from static/lib/font/source-sans-pro/source-sans-pro-semibolditalic.woff rename to static/reveal/lib/font/source-sans-pro/source-sans-pro-semibolditalic.woff diff --git a/static/lib/font/source-sans-pro/source-sans-pro.css b/static/reveal/lib/font/source-sans-pro/source-sans-pro.css similarity index 100% rename from static/lib/font/source-sans-pro/source-sans-pro.css rename to static/reveal/lib/font/source-sans-pro/source-sans-pro.css diff --git a/static/lib/js/classList.js b/static/reveal/lib/js/classList.js similarity index 100% rename from static/lib/js/classList.js rename to static/reveal/lib/js/classList.js diff --git a/static/lib/js/head.min.js b/static/reveal/lib/js/head.min.js similarity index 100% rename from static/lib/js/head.min.js rename to static/reveal/lib/js/head.min.js diff --git a/static/lib/js/html5shiv.js b/static/reveal/lib/js/html5shiv.js similarity index 100% rename from static/lib/js/html5shiv.js rename to static/reveal/lib/js/html5shiv.js diff --git a/static/plugin/highlight/highlight.js b/static/reveal/plugin/highlight/highlight.js similarity index 100% rename from static/plugin/highlight/highlight.js rename to static/reveal/plugin/highlight/highlight.js diff --git a/static/plugin/markdown/example.html b/static/reveal/plugin/markdown/example.html similarity index 100% rename from static/plugin/markdown/example.html rename to static/reveal/plugin/markdown/example.html diff --git a/static/plugin/markdown/example.md b/static/reveal/plugin/markdown/example.md similarity index 100% rename from static/plugin/markdown/example.md rename to static/reveal/plugin/markdown/example.md diff --git a/static/plugin/markdown/markdown.js b/static/reveal/plugin/markdown/markdown.js similarity index 100% rename from static/plugin/markdown/markdown.js rename to static/reveal/plugin/markdown/markdown.js diff --git a/static/plugin/markdown/marked.js b/static/reveal/plugin/markdown/marked.js similarity index 100% rename from static/plugin/markdown/marked.js rename to static/reveal/plugin/markdown/marked.js diff --git a/static/plugin/math/math.js b/static/reveal/plugin/math/math.js similarity index 100% rename from static/plugin/math/math.js rename to static/reveal/plugin/math/math.js diff --git a/static/plugin/multiplex/client.js b/static/reveal/plugin/multiplex/client.js similarity index 100% rename from static/plugin/multiplex/client.js rename to static/reveal/plugin/multiplex/client.js diff --git a/static/plugin/multiplex/index.js b/static/reveal/plugin/multiplex/index.js similarity index 100% rename from static/plugin/multiplex/index.js rename to static/reveal/plugin/multiplex/index.js diff --git a/static/plugin/multiplex/master.js b/static/reveal/plugin/multiplex/master.js similarity index 100% rename from static/plugin/multiplex/master.js rename to static/reveal/plugin/multiplex/master.js diff --git a/static/plugin/multiplex/package.json b/static/reveal/plugin/multiplex/package.json similarity index 100% rename from static/plugin/multiplex/package.json rename to static/reveal/plugin/multiplex/package.json diff --git a/static/plugin/notes-server/client.js b/static/reveal/plugin/notes-server/client.js similarity index 100% rename from static/plugin/notes-server/client.js rename to static/reveal/plugin/notes-server/client.js diff --git a/static/plugin/notes-server/index.js b/static/reveal/plugin/notes-server/index.js similarity index 100% rename from static/plugin/notes-server/index.js rename to static/reveal/plugin/notes-server/index.js diff --git a/static/plugin/notes-server/notes.html b/static/reveal/plugin/notes-server/notes.html similarity index 100% rename from static/plugin/notes-server/notes.html rename to static/reveal/plugin/notes-server/notes.html diff --git a/static/plugin/notes/notes.html b/static/reveal/plugin/notes/notes.html similarity index 100% rename from static/plugin/notes/notes.html rename to static/reveal/plugin/notes/notes.html diff --git a/static/plugin/notes/notes.js b/static/reveal/plugin/notes/notes.js similarity index 100% rename from static/plugin/notes/notes.js rename to static/reveal/plugin/notes/notes.js diff --git a/static/plugin/print-pdf/print-pdf.js b/static/reveal/plugin/print-pdf/print-pdf.js similarity index 100% rename from static/plugin/print-pdf/print-pdf.js rename to static/reveal/plugin/print-pdf/print-pdf.js diff --git a/static/plugin/search/search.js b/static/reveal/plugin/search/search.js similarity index 100% rename from static/plugin/search/search.js rename to static/reveal/plugin/search/search.js diff --git a/static/plugin/zoom-js/zoom.js b/static/reveal/plugin/zoom-js/zoom.js similarity index 100% rename from static/plugin/zoom-js/zoom.js rename to static/reveal/plugin/zoom-js/zoom.js