From 77d38e4f347b90edc8675a69b2f62bb2a280085b Mon Sep 17 00:00:00 2001 From: dzello Date: Mon, 23 Jul 2018 00:44:05 +0200 Subject: [PATCH] Document slide templates in the exampleSite presentation --- exampleSite/config.toml | 3 ++ exampleSite/content/_index.md | 3 +- exampleSite/content/example/_index.md | 1 - exampleSite/content/home/shortcodes/slide.md | 46 ++++++++++++++++++++ 4 files changed, 51 insertions(+), 2 deletions(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 566acf7..a5910a0 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -11,6 +11,9 @@ name = "Josh Dzielak" [params] description = "Includes a handy markdown-based syntax and shortcodes to help you get presentations done fast" +[params.reveal_hugo] +history = true + [outputFormats.Reveal] baseName = "index" mediaType = "text/html" diff --git a/exampleSite/content/_index.md b/exampleSite/content/_index.md index 13b4600..0d3dff5 100644 --- a/exampleSite/content/_index.md +++ b/exampleSite/content/_index.md @@ -4,11 +4,12 @@ description = "A Hugo theme for creating Reveal.js presentations" outputs = ["Reveal"] [reveal_hugo] custom_theme = "reveal-hugo/themes/robot-lung.css" -history = true margin = 0.2 highlight_theme = "color-brewer" transition = "slide" transition_speed = "fast" +[reveal_hugo.templates.hotpink] +background = "#FF4081" +++ # 📽️ diff --git a/exampleSite/content/example/_index.md b/exampleSite/content/example/_index.md index 65d5b2b..91a81a7 100644 --- a/exampleSite/content/example/_index.md +++ b/exampleSite/content/example/_index.md @@ -3,7 +3,6 @@ title = "Example of a section presentation" outputs = ["Reveal"] [reveal_hugo] theme = "moon" -history = true +++ # Section Presentation diff --git a/exampleSite/content/home/shortcodes/slide.md b/exampleSite/content/home/shortcodes/slide.md index 7c77e51..02c8e3a 100644 --- a/exampleSite/content/home/shortcodes/slide.md +++ b/exampleSite/content/home/shortcodes/slide.md @@ -81,6 +81,52 @@ Slide attribute possibilities from the [Reveal.js docs](https://github.com/hakim {{% section %}} +## Slide templates + +Store sets of common slide attributes in front matter variables and apply them to slides with the template attribute. + +
+ +navigate down to learn more + +
+🔽 + +--- + +Create templates in config.toml, _index.md or the current page's front matter. Put them under the **templates** key with a meaningful name: + +```toml +[reveal_hugo.templates.hotpink] +background = "#FF4081" +``` + +--- + +{{% slide template="hotpink" %}} + +Apply the template using the **template** attribute of the slide shortcode: + +```markdown +{{%/* slide template="hotpink" */%}} + +# I'm a hot pink slide! + +{{%/* /slide */%}} +``` + +{{% /slide %}} + +--- + +If a template exists in multiple configurations, it's properties will be merged. If a property is declared multiple times, the order of precedence is page, section (_index.md), site (config.toml). + +{{% /section %}} + +--- + +{{% section %}} + {{% slide content="home.example" /%}} {{% /section %}}